Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Just an additional note on that - while your regex is better written as chomp($user) you can make an improvement by using a character class instead of alternation: You wrote $user =~ s/(\r|\n)//. You *meant* $user =~ s/(\r|\n)$// since that newline should only occur at the end of the string. That group is capturing but it doesn't need to $user =~ s/(?:\r|\n)$//. Don't use capturing where it's not needed. In fact - grouping is wasteful for single character alternation. Use a character class instead $user =~ s/[\r\n]$//. And even better use chomp() chomp($user). In reply to Re: Re: while loop over filehandle
by diotalevi
|
|