Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Perl::Critic says don't modify $_ in list functions and other things

by Tux (Canon)
on Jul 09, 2020 at 08:35 UTC ( [id://11119074]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl::Critic says don't modify $_ in list functions and other things
in thread Perl::Critic says don't modify $_ in list functions and other things

If you have 5.14.0 or higher, why not use s///r?

my @list = map { s/\r\n$//r } <$fh>; my @uc_list = map { uc s/\r\n$//r } <$lc_fh>; my @split_list = map {[ split m/\|/ => s/\r\n$//r ]} <$piped_fh>;

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^3: Perl::Critic says don't modify $_ in list functions and other things
by marto (Cardinal) on Jul 09, 2020 at 08:37 UTC

    From OPs signature: 'My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.8.8 on web host.'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11119074]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-23 14:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found