在linux中运行命令行
perl -e 'print "Hello world\n"'
MS-DOS中运行命令行
perl -e "print qq(Hello world\n)"
直接调用shell并输出
#!/usr/bin/perl -w
my $now=`date`;
print "The time is now $now";
#!/usr/bin/perl -w
foreach (`who`) {
my($user,$tty,$date=/(\S+)\s+(\S+)\s+(.*)/;
$ttys{$user} .="$tty at $date\n"
}