my $string = "./t2"; my $string2 = "/some/path/to/t3"; my $base = (split(/\//, $string))[-1]; my $base2 = (split(/\//, $string2))[-1]; print "$base\n$base2\n";
In reply to Re: split string and always get last word
by linux454
in thread split string and always get last word
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |