![]() |
|
|
|||||||
| Home | Forums | Register | Rules & FAQ | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. Shell Script Page. |
Other UNIX.COM Threads You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Find String in Perl | mahalakshmi | Shell Programming and Scripting | 11 | 04-26-2008 02:29 PM |
| How to determine if a script (perl) was called from a CRON job or commandline | jerryMcguire | Shell Programming and Scripting | 2 | 03-23-2006 06:47 AM |
| $A is a number / any other string? How to determine ? | csaha | Shell Programming and Scripting | 2 | 02-21-2006 12:03 AM |
| determine file type with perl | umen | Shell Programming and Scripting | 1 | 01-11-2006 07:00 AM |
| Perl Ping Determine Success or Fail | gdboling | Shell Programming and Scripting | 1 | 06-20-2003 02:50 PM |
![]() |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hi,
I have a little Perl question. I need to determine the last word in the following string: h t t p://abc.def.com/hijklm The output should be the string hijklm. h t t p is of course http. The string between the slashes always differs. The string after the last slash always differs. Any idea how to do this ? Best regards, ejdv |
| Forum Sponsor | ||
|
|
|
|||
|
And $arr[-1] is the last element of @arr, no matter how many elements you ended up with. You could also use a regex match:
Code:
$str =~ m%([^/]*)$%; print $1 |
|||
| Google UNIX.COM |