试试,看看能否真的替代AWK,SED这些的。。。
#!/usr/bin/perl print "hello, world!\n"; $line = <STDIN>; if ($line eq "\n") { print "That was just a blank line!\n"; }else { print "That line of input was: $line"; } ; ) { ; print "count is now $count\n"; } $madonna = <STDIN>; if ( defined($madonna) ) { print "The input was $madonna"; } else { print "No input available!\n"; }