c:\@Work\Perl\monks\cbtshare>perl -wMstrict -le "my @file = `cat text.txt`; ;; foreach my $line (@file) { while ($line =~ /name \s+(.*?) \s+(.*?)/mgx) { my $name = $1; print qq{name '$name' other '$2'}; } } " name 'Brian' other '' name 'Andrew' other '' name 'ryan' other ''