in reply to saving matching pattern with flip-flop operator
You could use $1, but I expect problems with retained old values if the regex didn't match.
So I prefer to directly, explicitly capture the captured value. Like this:
BTW | is for bitwise or; you (ought to) want either or or ||.while (<>) { if(/START/ ... (my($time) = /END TIME (.+)/)) { unless(defined $time) { next if /START/ || /^\s*$/; print; } else { print "End time at $time\n"; } } }
In Section
Seekers of Perl Wisdom