in reply to pattern matching and return values

Perl Idioms Explained - @ary = $str =~ m/(stuff)/g

cheers

tachyon

Replies are listed 'Best First'.
Re^2: pattern matching and return values
by Your Mother (Archbishop) on Jul 18, 2004 at 06:26 UTC

    lame but fun; don't follow this idiom|t.

    use Data::Dumper; my $stuff = 'ASDFZXCV S;JL KJQWER QWER ZXCVO ;QLKWERQ JKL;JAPS'; my %hash; my @keys = qw( asdf qwer jkl; ); @hash{@keys} = $stuff =~ / (asdf) .*? (qwer) .*? (jkl;) /gix; print Dumper \%hash;

      I'm with you there! Just because you can does not mean you should.

      cheers

      tachyon