Inserting Line Number.

Discussion in 'Perl' started by rmurthy60@hotmail.com, Nov 9, 2003.

  1. Guest

    Inserting Line Number

    --------------------------------------------------------------------------------

    I would like to insert line numbers for all the files in a directory.
    So if a directory contains files like foo.c, foo.c1, foo.c2, foo.c3,
    foo.c4, I am trying to see and choose one of the numbers to process
    it.

    1. foo.c1

    2. foo.c2

    3. foo.c3

    4. foo.c4

    Can I use __LINE__ or $. to do that or am I wrong?

    Any suggestions or ideas would be appreciated.

    Thanks

    Raghu
     
    , Nov 9, 2003
    #1
    1. Advertising

  2. wrote:
    > I would like to insert line numbers for all the files in a
    > directory.


    <snip>

    > Can I use __LINE__ or $. to do that


    __LINE__ refers to your program, so it seems not very useful. $. is
    certainly a better shot.

    Note that this group is defunct and replaced by comp.lang.perl.misc.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Nov 9, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alan Silver
    Replies:
    2
    Views:
    382
    Alan Silver
    Nov 14, 2005
  2. Hugo
    Replies:
    10
    Views:
    1,345
    Matt Humphrey
    Oct 18, 2004
  3. kaushikshome
    Replies:
    4
    Views:
    796
    kaushikshome
    Sep 10, 2006
  4. scad
    Replies:
    23
    Views:
    1,194
    Alf P. Steinbach
    May 17, 2009
  5. Marek Stepanek
    Replies:
    12
    Views:
    424
    Peter J. Holzer
    Sep 2, 2006
Loading...

Share This Page