Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    
    $str =~ m/ (?{ $first = substr($str, 0, 1); $last = substr($str, -1) }
    +) /x;
    print "first: '$first';    last: '$last'\n";