die "No '>>' allowed!\n" if /^>>/; my $file; if (/[<>](.*)/) { $file=$1; } else { # what to do? You didn't specify... }