Quote:
Originally posted by archael
alright im gonna give this a try.
But I also meant to ask, i see the $_ and @_ everywhere but have no idea what that means.
Can you explain it?
Thanks,
Jon
|
I'll start with @_.
When you define a subroutine, perl by default takes arguments as an array in the @_ array;
example:
Code:
sub bob()
{
my $firstArg = @_[0];
my $secondArg=@_[1];
}
The $_ is the current value in a loop pretty much.
Instead of :
Code:
foreach my $thisItem (@array)
{
print $thisItem;
}
you can do :
Code:
foreach (@array)
{
print $_; ### same as this item
}