Jm lists wrote:
2007/3/16, John W. Krahn <[EMAIL PROTECTED]>:
My guess is that the file 'itemid.txt' was created on DOS/Windows and you are
running the program on some form of Unix.
man dos2unix
Or you could remove all trailing whitespace:
while ( <HD> ) {
s/\s+\z//;
push @arr, $_;
}
Or you could extract just the numbers:
my @arr = do { local $/; <HD> } =~ /\d+/g;
Thanks John.That's the right way.
Another question,what's the regex of "\s+\z" ?
\s matches any single whitespace character (space, tab, carriage-return,
linefeed or formfeed)
So \s+ matches one or more of these.
\z matches the end of the string
So \s+\z matches one or more whitespace characters at the end of the string
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/