in reply to Match the starting \>
Not entirely sure I understand, but maybe you want a character class [...], i.e.
for ("< foo\n", "> bar\n") { my $lines = $_; if($lines =~ m/[<>]/){ $lines =~ s/^[<>]\s//; # do something else... } print $lines; } __END__ foo bar
Update: as grizzley suggested, you could also use /<|>/ (alternation). While that would even be one char less to type in your match, it would become slightly more unwieldy in case the regex needs to contain other stuff, like in the substitution:
$lines =~ s/^(?:<|>)\s//;
(the (?:...) groups without capturing)
|
|---|