Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: one-line split file sequence checker

by wdef2 (Acolyte)
on Jan 24, 2008 at 15:43 UTC ( #664056=note: print w/ replies, xml ) Need Help??


in reply to Re: one-line split file sequence checker
in thread one-line split file sequence checker

Nice, thx. Could golf slightly further I suppose to:

perl -e '/(\d+)$/and$t[$1]=1for<*>;while($c<$#t){$t[++$c]||print "$c "}'

I like that since it seems quite readable as well (at least for me) Though is map more efficient than while?


Comment on Re^2: one-line split file sequence checker
Download Code
Re^3: one-line split file sequence checker
by kyle (Abbot) on Jan 24, 2008 at 16:48 UTC

    map may or may not be more efficient, but it's certainly shorter:

    perl -le '/(\d+)$/and$t[$1]=1for<*>;map$t[$_]||print,1..$#t'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2014-12-19 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (69 votes), past polls