my($version, $int) = /## my($version) = /## my($version) = /## #!/usr/bin/perl -w foreach ( '', '', q<>, ) { if(/ \s+ [a-zA-Z][^\s\/=>'"]* \s* = \s* (?: " [^"]* " | ' [^']* ' ) )*? \s+ version \s* = \s* (?:"([^"]*)"|'([^']*)') /x) { print "Match '$+' in $_\n"; } else { print "No match in $_\n"; } } #### Match '24.0' in Match '24.0' in Match '24.0' in