Sign-up....

you 2 ge kong-ge zen-me-ban?

#!/use/bin/perl

open (FH, "text.txt") or die "Can't open text.txt";

while ($_ = <FH>) {

print $_;

@ feld = split (/ /,$_);

$station=0;

while ($feld[$station])

{

print $feld[$station]."\n";

$station++;

}

}

close(FH);

text.txt:

1 2 3 4 5

[402 byte] By [msdn] at [2007-11-17 11:05:59]
# 1 Re: you 2 ge kong-ge zen-me-ban?

@ feld = split (/\s+/,$_);

另外:

$station=0;

while ($feld[$station])

{

print $feld[$station]."\n";

$station++;

}

这里用FOREACH会更简洁

foreach (@ feld) { print "$_\n"; }

liu22 at 2004-9-16 21:44:51 >

其他开发语言

All Classified