Wednesday, October 04, 2006

Shift and $_

Took me a whiole to figure out what the hell 'shift' and $_ do

my $suck =shift;
print $suck;

[root@rooted_Box]$ perl suck.pl 2
2

my $suck =shift || '192.168.1.1'; //Show 192.168.1.1 if no arg
print $suck;

[root@rooted_Box]$ perl suck.pl
192.168.1.1

my @arr =("a","b","c");
for(@arr){print $_."\n"};

output:
a
b
c

um....perl syntax!!

No comments: