Harry Putnam wrote: > > How can I get var1 and var2 in one step using s/// type method? > (Not using split) > > cat test.pl > #!/usr/local/bin/perl -w > > $incoming = shift; > ## Where incoming looks like '-A -a' > ($var1 = $incoming) =~ s/(^ *\-)([A-Z])( *\-)([a-z])/$2/; > ($var2 = $incoming) =~ s/(^ *\-)([A-Z])( *\-)([a-z])/$4/; > print "$var1\n$var2\n"; > > ./test.pl '-A -a' > A > a > > I've tried various paran schemes to extract var1 and var2 in one > step but only get errors.. example: > > (($var1, $var2) = $incoming) =~ s/(^ *\-)([A-Z])( *\-)([a-z])/$2/;
$incoming =~ s/^( *-)([A-Z])( *-)([a-z])/($var1, $var2)=($2,$4)/e; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>