shilpam has asked for the wisdom of the Perl Monks concerning the following question:
My problem is: I want the script to treat the variable after every 4 words as a new record.open(DAT,"C:\\StudyPerl\\Projects\\tab_file.txt") || die "Could not op +en the file"; my @line; my @array1; while(<DAT>){ @line = split(/\t/,$_); $array1[0]=$line[0]; $array1[1]=$line[1]; $array1[2]=$line[2]; $array1[3]=$line[3]; } foreach $1 (@array1){ print "The element is: $1\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl script to read a tab delimited text file
by maa (Pilgrim) on Apr 01, 2004 at 11:54 UTC | |
|
Re: Perl script to read a tab delimited text file
by Happy-the-monk (Canon) on Apr 01, 2004 at 11:55 UTC | |
by Happy-the-monk (Canon) on Apr 01, 2004 at 13:30 UTC | |
|
Re: Perl script to read a tab delimited text file
by dragonchild (Archbishop) on Apr 01, 2004 at 12:54 UTC | |
|
Re: Perl script to read a tab delimited text file
by borisz (Canon) on Apr 01, 2004 at 11:54 UTC | |
|
Re: Perl script to read a tab delimited text file
by Crian (Curate) on Apr 01, 2004 at 14:16 UTC |