in reply to Control Flow Puzzle
Although that spits out warnings under -w, so maybe:$_ = <INFO> until !defined($_) || /^(\* Menu:|\037)/; return %header unless /Menu/;
and you don't really need the second regex so maybe:$_ = <INFO> until !defined($_) || /^(\* Menu:|\037)/; return %header unless defined and /Menu/;
Or if you want to split the regex:$_ = <INFO> until !defined($_) || /^(\* Menu:|\037)/; return %header unless defined and index($_, 'Menu') >= 0;
And then of course you could use substr() instead of a regex for the \037 test...my $menu; $_ = <INFO> until !defined($_) || ($menu = /^\* Menu:/) || /^\037/; return %header unless $menu;
|
|---|