Wednesday, 17 June 2015

Perl variabe input + stdin + arguement pass

[root@ENGWEB01T ~]# cat samd.pl

$s=( ! "$ARGV[0]" )?(<STDIN>):($ARGV[0]);
print $s."\n";

[root@ENGWEB01T ~]# perl samd.pl sam
sam
[root@ENGWEB01T ~]# perl samd.pl
sam
sam

No comments:

Post a Comment