#!/usr/bin/perl
@array = (1,2,3,4);
print $array[$#array];
(OR)
#!/usr/bin/perl
@array = (1,2,3,4);
print $array[-1];
To
Insert line number in a file from command line
perl -pi -e'$_ = sprintf "%04d %s", $., $_' filename
To
Edit the file content from command line
perl -pi -e 's/cat/dog/' filename
#!/usr/bin/perl
$str = "hello";
# original string
$ref = \$str; #
compute $ref that points to $str
print "$$ref\n"; # prints "hello" -- identical
to "$str\n";
For more..
njoy the simplicity.......
Atul Singh
No comments :
Post a Comment