Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: do $n exist in grep?

by Marshall (Canon)
on May 12, 2021 at 15:19 UTC ( #11132491=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    ..Bxys
    xxAx
    =cut
    
  2. or download this
    #ok, with a weird example of $1
    @result = grep{ print "$1 $_\n" if /^..(A|B)./;
    ...
    
    # grep {} executes the code within the brackets and passes the input
    # to @result depending upon the true/false value of the last statement
    +.
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2021-09-18 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?