On Fri, Jul 21, 2006 at 02:24:00PM +0800, Sayed, Irfan (Irfan) wrote:
> Hi,
>  
> I need to read a specific file and put the each line of that file into
> an array.
>  
> I mean first line will go to the first position of the array , second
> line shud go to the second position of the array and so on.

You could always use while (<>) for that.  For instance:

  #!/usr/bin/perl
  use strict;
  use warnings;

  my @foo;

  push(@foo, $_) while (<>);

Then, just call your script with a filename:

  $ scriptname filename

There are other ways as well, of course.  That's my favorite.

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Brian K. Reid: "In computer science, we stand on each other's feet."

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to