#!/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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to