D
DelphiDude
REAL newbie. I just got my book in the mail yesterday. And of course at
this point, I am not trying to produce anything, just understand stuff
that is a long way from Turbo Pascal and C++.
So far everything falls into place once I code it up and change it around
and play with it.
However, some questions on the following snippit (which doesn't work, by
the way).
#!/usr/bin/perl -w
testsub("testword");
sub testsub{
print $_[0]; # just as a test to see if it works.
if ($_[0] = /test/){
print "found it";
}
}
First off, as I understand it, a call to a sub with a value(s)
automatically puts it into a temporary array called $_[].
And it actually does work. I can print the value of $_[0] which correctly
comes out as "testword". But the match comparison errors out with...
Use of uninitialized value in pattern match (m//) at ./test2 line 7.
What value? The left side variable is ok. The /test/ is just a string
pattern as far as I can see.
My Perl book kind of glosses over this part and move on to much more
indepth pattern matching. Can anybody clue me in?
DD
this point, I am not trying to produce anything, just understand stuff
that is a long way from Turbo Pascal and C++.
So far everything falls into place once I code it up and change it around
and play with it.
However, some questions on the following snippit (which doesn't work, by
the way).
#!/usr/bin/perl -w
testsub("testword");
sub testsub{
print $_[0]; # just as a test to see if it works.
if ($_[0] = /test/){
print "found it";
}
}
First off, as I understand it, a call to a sub with a value(s)
automatically puts it into a temporary array called $_[].
And it actually does work. I can print the value of $_[0] which correctly
comes out as "testword". But the match comparison errors out with...
Use of uninitialized value in pattern match (m//) at ./test2 line 7.
What value? The left side variable is ok. The /test/ is just a string
pattern as far as I can see.
My Perl book kind of glosses over this part and move on to much more
indepth pattern matching. Can anybody clue me in?
DD