Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^2: join program in one-liner

by bmann (Priest)
on Aug 19, 2005 at 22:16 UTC ( #485318=note: print w/replies, xml ) Need Help??

in reply to Re: join program in one-liner
in thread join program in one-liner

Same as yours, but cut out unnecessary space and get rid of the END block:

# 1 2 3 4 #23456789012345678901234567890123456789012345 perl -lne'$a[$.].=$_;$.=0if eof}{print for@a'

BTW, perldoc perlvar says:

$. is reset when the filehandle is closed, but not when an open filehandle is reopened without an intervening close(). For more details, see "I/O Operators" in perlop. Because "<>" never does an explicit close, line numbers increase across ARGV

Replies are listed 'Best First'.
Re^3: join program in one-liner
by truedfx (Monk) on Aug 28, 2005 at 11:40 UTC
    And $.=0if eof can be changed:
    # 1 2 3 4 #234567890123456789012345678901234567890123 perl -lne'$a[$.].=$_;$.*=!eof}{print for@a'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://485318]
[LanX]: I doubt
[LanX]: only nonlocal in Py3
[shmem]: so, python sucks
LanX NSFW!!!

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2018-03-20 17:53 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (256 votes). Check out past polls.