On Oct 5, 2005, at 16:30, Gladstone Daniel - dglads wrote:
Can someone help me understand what this line does?
my ($tablename, $filepath, $ifilename, $ojob) = @ARGV;
Can someone give me a good place to look verbs up so I can get a
Better understanding of this program.
Sure, @ARGV is an array that contains the arguments received by the
script, if any. Thus, if the program is invoked like this
perl myscript.pl foo 5
the array @ARGV contains the strings "foo", and "5", in that order.
The assignment is called a "list assignment": it assigns each element
of the array @ARGV respectively to the variables $tablename,
$filepath, etc. That is, the first element of @ARGV goes to
$tablename, the second one to $filepath, and so on.
If @ARGV has less than 4 elements the variables that have no
corresponding element in @ARGV are initialized with the especial
escalar value undef. If @ARGV has more than 4 elements, the ones past
the fourth are just ignored.
In any case @ARGV is not modified at all.
The "my" at the beginning is declaring the escalar variables and has
a few more implications, but I guess is too early to explain them.
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>