Front page | perl.beginners |
Postings from February 2002
arrays + split
Thread Next
From:
Stuart Clark
Date:
February 26, 2002 19:53
Subject:
arrays + split
Message ID:
002501c1bf42$d3f01d40$bd00a8c0@spacelink.net.au
Hi All,
How do i gather an array of data from a line which has no delimiters.
The data is put into positions relative to the start of the line.
Below is an example of the problem for this newsgroup.
The live script has far more variables.
Regards
Stuart Clark
EG:
###test file
fred barney wilmadino betty
daffygoofy taz plutodonald
#string 1 will be position 1-5 on the line
#string 2 will be position 6-15 on the line
#string 3 will be position 16-23 on the line
#string 4 will be position 24-28 on the line
#string 5 will be position 29-34 on the line
################################
open (IN,"testfile") || die "could not open input file\n";
open (OUT,"outfile") || die "could not open output file\n";
while (<IN>) {
chomp $_;
($cartoon1,$cartoon2,$cartoon3,$cartoon4,cartoon5) = split (what goes
here??);
print OUT $cartoon2. $cartoon4. "\n";
close (IN) || die "could not close input file\n";
close (OUT) || die "could not close output file\n";
Thread Next
-
arrays + split
by Stuart Clark