#!/usr/bin/perl use strict ;
my @strings = ( "Fred and Barney",
"Gilligan or Skipper",
"Fred and Ginger"
);
foreach my $string (@strings)
{
$string =~ m/(\S+)(and|or)(\S+)/;
print "\$1: $1\n\$2: $2\n\$3: $3\n";
print "-" x 10, "\n";
} ;
Why the results is:
$ ./grouping_example.pl
$1:
$2:
$3:
----------
$1:
$2:
$3:
----------
$1:
$2:
$3:
----------
no value output?
Thanks,
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/
