my $fractionValue =
( $str =~ m{^(\d+)/([1-9]\d*)} ) # regex match will evaluate to true or false
? # the "ternary operator" -- if above condition is true, then...
$1/$2 # return this value (using the 1st and 2nd matched digit strings
: # otherwise (if above condition was false), ...
"undefined" # return this value
; # end of statement
####
/blah/
m/blah/
m=blah=
m!blah!
m{blah}
####
/http:\/\/my\/path\/to\/insanity/
m{my/path/back/to/sanity}
####
$_ = "123.456/789-0";
if ( /(\d+)\D(\d+)\D(\d+)/ ) {
printf( "Found three numbers: %d was between %d and %d\n", $2, $1, $3 );
}
####
if ( $_ =~ /(\d+)\D(\d+)\D(\d+)/ ) { ...