Not hardcoded(test) ,it can contain any texts.
if i have "<$filename" or ">$filename",the matching operation should separate "<"/">" and "$filename"
if i have ">>$filenaem", the program should terminate
die "No '>>' allowed!\n" if /^>>/;
my $file;
if (/[<>](.*)/) {
$file=$1;
} else {
# what to do? You didn't specify...
}
Any possibility to do this in one matching.
Generally people who want to do stuff like this in "one matching" when asked about the reason why, cannot give a good one. Do you have any? |