Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Re: LOC

by Chmrr (Vicar)
on Jul 25, 2002 at 19:49 UTC ( #185308=note: print w/replies, xml ) Need Help??

in reply to Re: LOC
in thread Counting lines of C code

As a side note, it's probably slightly easier to say:

perl -e '1 while <>; print "$.\n"' file1.c file2.c

..which is what the $. special variable is more or less meant for.

perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

Replies are listed 'Best First'.
Re: Re: Re: LOC
by jsprat (Curate) on Jul 25, 2002 at 20:13 UTC
    Or equivalently, (still naive as dws points out, but a few less keystrokes :-)

    perl -lne'}{print$.' file1.c file2.c

    Update: Massaged one-liner, but still manage to lose by 2 strokes...

      If it's a golfin' that ye'll be wantin', just say so!

      perl -ple'}{$_=$.' file1.c file2.c

      Update: Shaved off a semicolon.

      perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://185308]
[shmem]: LanX: tried strange stuff wrt autocomplete. No luck :(
[erix]: sambuca
[LanX]: machiato!
shmem fills a glas with sambuca, drops 3 beans of coffee into it, lights the stuff and hands it to erix
[Your Mother]: Liquore Strega. :P
[shmem]: s/beans of coffee/enterprise beans/ :-P
[erix]: Take your bottles -- you're all invited! :)

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2017-03-28 12:20 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (330 votes). Check out past polls.