Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

TomDLux

by TomDLux (Vicar)
on Feb 11, 2002 at 20:36 UTC ( #144696=user: print w/replies, xml ) Need Help??

The photo from my audtion for The Sopranos

  • Goal - snap up the reputation points before merlyn gets them; he already has enough. Why does this remind me of PacMan?

    start
    Spring, 2003
    500
    June, 2003
    1000
    August, 2003
    1600
    November 24, 2003 ( 37,677 to go )
    2300
    February 14, 2004 ( 38,507 to go )
    Hmm ... I'm supposed to be catching up, not falling further behind!
    3000
    March 30, 2004 ( 38,984 to go )
    I think he's slowing down!
    ( only 1003220 behind vroom )
    3500
    May 14, 2004 ( 39,837 to go )
    ( only 1002913 behind vroom )
    i.e. I'll catch up with Vroom in June, 2412, at which point merlyn will have 2,793,292.
    4000
    July 27, 2004 ( 40,894 to go ... having a job is slowing me down )
    ( only 1002506 behind vroom )
    4555
    July 2005. I missed the 4500 odometer click. Good news is merlyn is only 40139 ahead. I may have slowed down, but he's slowed down MORE! ( 1002397 behind Vroom .... I'll catch up in about 9196 years )
    5000
    July, 2006. Good news is merlyn is only 55,880 ahead.
    5403
    September, 2010. He's had a sluggish half-decade too, stuck at 70400.
    6910
    June, 2016. He's at 71175. I'm further behind than ever!

  • My Perl Consulting company web page

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[tobyink]: You can use grep { $_ =~ /.*$in.*/; } @my_modules but why not stick to grep(/.*$in.*/, @my_modules)? (The latter is faster.)
[shmem]: Lady_Aleena, in the first example grep evaluates the result from grep and if true, returns $_. In the second, it always returns $_
[shmem]: ..the result from the pattern match
[Lady_Aleena]: tobyink, I did after I failed to get the BLOCK to work. I can't seem to get my brain around grep BLOCK, though I'm okay with grep EXPR.
[shmem]: so in the second example grep returns all true elements of the list passed
[Lady_Aleena]: Okay, so grep BLOCK is not like map BLOCK where something might need to be returned at the end.
[tobyink]: grep { $_ =~ /.*$in.*/; } @my_modules should work just fine. The problem is that you were adding on ;$_ at the end of the block. Why were you doing that?
[Lady_Aleena]: tobyink, I was thinking map.
[tobyink]: Something does need to be returned at the end not $_ though. You need to return (something that will be evaluated as) a boolean.
[Lady_Aleena]: Here is a longish map I did in the same script. my @my_modules = map { my $file = $_; $file =~ s/$module_director y(.+)\.pm/$1/; $file =~ s/\//::/g; $file; } @files;

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2017-05-27 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?