Are you familiar with chomp( $str ) ? Often you will want to use chomp to get 
rid of trailing newlines on your input lines.

On 07/21/2011 11:11 PM, Mike McClain wrote:
Given the following snippet of code could someone explain to me
why the linefeed gets included in $num?

mike@/deb40a:~/perl>  perl -e'
$str = "asdfggfh 987321qwertyyy\n";
($num = $str) =~ s/^.*?(\d+).*$/$1/;
print $num;
' | hd
00000000  39 38 37 33 32 31 0a                              |987321.|
00000007

Thanks,
Mike

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to