Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 imbibing at the Monastery: (3)
As of 2021-08-04 07:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)








    Results (41 votes). Check out past polls.

    Notices?