Help for this page

Select Code to Download


  1. or download this
    print "$last_name;
    #     ^
    
  2. or download this
    my $total_names = "Matthew,Thomas,Peter,Randy,George,Federick";
    $total_names =~ /,([^,]+)$/;
    print $1 if $1;
    
  3. or download this
    my $total_names = "Matthew,Thomas,Peter,Randy,George,Federick";
    my ($last_name) = $total_names =~ /,([^,]+)$/;
    print $last_name if $last_name;
    
  4. or download this
    my $last_name = ( split /,/, $total_names ) [ -1 ] ;