#!/usr/local/bin/perl -w
use strict;
my @data = ('NUMBERS: ONE TWO THREE',
'WORDS: CAT MOUSE DOG');
my (@numlist, @wordlist);
foreach my $line (@data) {
print "$line\n";
if ($line =~ /^NUMBERS:/) {
#
#Need to shift $line so $line becomes only ONE TWO THREE
or the assigment to @numlist will
#only be ONE TWO THREE
#perhaps something equivalent to shift @{$line};
although shift wants array
#What are my options ??
#
@numlist=split ' ', $line;
} elsif ($line =~ /^WORDS:/) {
#similar need to above comments
@wordlist=split ' ', $line;
}
}
[EMAIL PROTECTED], @wordlist should not contain first value of NUMBERS: or
WORDS:
print "\n";
print "$_\n" foreach (@numlist);
print "\n";
print "$_\n" foreach (@wordlist);
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs