Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 surveying the Monastery: (6)
As of 2014-08-28 04:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (256 votes), past polls