Question: Here I don't want the $& have whole the value of line. I need $2 only even I omit the extra groups also the $& have value. How can I avoid this?use strict; use warnings; open FH,"data" or die "can't open the file"; while(<FH>) { if(~/^<dsk1/) { my $line=$_; # print $line; $line=~/.*\sid=\"(.*)\"\slo=\"(.*)\"\sto=\"(.*)\"\srb= +.*$/; print "$2\n\n"; print "$&\n"; } }
In reply to regular expression. by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |