my $x = "this is a string"; my $y = (split ' ', $x)[-1]; print "$y\n"; ######## OR ######## my $x = "this is a string"; print( (split ' ', $x)[-1], $/);