Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by Lady_Aleena (Priest)
on Jul 09, 2020 at 01:29 UTC ( [id://11119056]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      my @list       = map { chomp($_); $_ } <$fh>;
      my @uc_list    = map { chomp $_; [uc $_] } <$lc_fh>; # used only onc
    +e
      my @split_list = map { chomp $_; [ split(/\|/, $_) ] } <$piped_fh>; 
    +# used only once
    
  2. or download this
      my @array = map {
        $_ =~ s/^[\*\+-] (.+)/$1/;
        some_sub($_, $opt);
      } @another_array;
    
  3. or download this
      my @ids = map {
        $_ =~ s/<.+?>//g;
    ...
        $_ =~ s/[^\w:.\-]//g;
        $_;
      } grep {defined($_)} @base;
    
  4. or download this
    sub fancy_map {
      my ($opt, $list) = @_;
    ...
        }
      } @{$list};
    }
    
  5. or download this
      if ($raw_value =~ /\*/) {    # multiplication
        $total_value = eval($raw_value);
    ...
        $base_value = eval($raw_value);
        ($total_value, $amount) = split(/\//, $raw_value);
      }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11119056]
Approved by Marshall
Front-paged by davies
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-25 11:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found