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

Re^3: How can i debug compound map/grep statements just using print?

by Kenosis (Priest)
on Dec 01, 2012 at 21:39 UTC ( #1006645=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    =item B<-a, --amount>
    
    Search for files older than <amount> days, mandatory.
    
  2. or download this
    $amount = $amount * 24 * 60 * 60;
    
  3. or download this
    $result =
      grep { /.+\.$suffix$/ and $time - ( $_->stat )[9] >= $amount }
      io($dir)->all;
    
  4. or download this
    $result = File::Find::Rule->file()
                              ->maxdepth(1)
                              ->name(qr/.+\.$suffix$/i)
                              ->mtime(">= $amount")
                              ->in($dir);
    
  5. or download this
    $result = grep { -M >= $amount / 86400 } # Convert back to days
              File::Find::Rule->file()
                              ->maxdepth(1)
                              ->name(qr/.+\.$suffix$/i)
                              ->in($dir);
    
  6. or download this
        $result =
          grep { $_ == 1 }
    ...
          map  { ( $_->stat )[9] }  # e.g i'm interested in this...
          grep { $_->name =~ /.+\.$suffix$/ } # ...and this
          io($dir)->all;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006645]
help
Chatterbox?
[marioroy]: Disciplus My wife and I went on vacation. At work, I was stuck polling SNMP from 20 million devices. It would hang at 80,000. On the mist boat, hear a voice to enable grace in the design that 10x and more performance awaits.
[Lady_Aleena]: Women need challenges too karlgoethebier. 8)
[marioroy]: s/hear/heard/
[karlgoethebier]: Discipulus: No. See https://en. wikipedia.org/ wiki/Tribe_( Native_American)
[karlgoethebier]: They took Unix from some aliens
[marioroy]: Perl is so powerful that it can poll 40 metrics from 20 million devices in 40 minutes using 4 nodes only.
[karlgoethebier]: http://www. uncoveror.com/ aliens.htm
[Lady_Aleena]: marioroy, I can't decide whether or not to move my RolePlaying:: Random:: modules to just Random::. I'm not as sophisticated as most here.
[marioroy]: Naming things can be difficult, sometimes more so that the actual code :)
[karlgoethebier]: Lady_Aleena: You need to jump to some conclusion

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2017-05-29 08:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?