Shawn Milochik wrote:
>
> Just a couple of questions about your corrections: (All snippets are taken
> from the e-mail below.)
>
> > Shawn:
> > sub parseFrom400 {
> > my $value = @_[0];
> ^^^^^
> John:
> You want a scalar here, not an array slice.
>
> my $value = $_[0];
>
> Shawn:
> Okay. I just put this in because I saw the syntax somewhere else. Why is
> this better? It works fine as it is.
Unless you have warnings enabled.
$ perl -wle'@a = qw/a b c d/; $x = @a[0]; print $x'
Scalar value @a[0] better written as $a[0] at -e line 1.
a
You should enable warnings and strict when developing programs to catch
mistakes like this.
> Shawn:
> > my $delimiter = substr($value, 3, 1);
> > if ($delimiter =~ /[0-9]./){
> ^
> John:
> Do you want to match any character except newline here or a literal
> dot? Since $delimiter only contains one character trying to match two
> characters will never work.
>
> if ( $delimiter =~ /\d/ ) {
>
> Shawn:
> I wanted to find out if the character is numeric. I see that your line
> above is exactly what I really wanted. It seems to be working, though.
> The database I'm
> ultimately populating with this data seems to be okay. Does what I wrote
> do the same thing, although in an ugly way?
No, your regular expression was trying to match two characters however
the variable $delimiter only contains one character.
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]