I thank you will have to use substr since you have daffygoofy and you have
nothing to split on, so use substr to get the data.
Wags ;)
-----Original Message-----
From: Stuart Clark [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 26, 2002 19:57
To: perllist
Subject: arrays + split
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";
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]