Brent Clark schreef:

> I have some paths like so.
>
> /home/brent/cgi-bin/scripts/common/ticktaktoe
> /home/brent/cgi-bin/scripts/agent/ticktaktoe
>
> This is my regex.
>
> ($q) = $ht_file =~ /^(.*)\/[^\/]+/;
>
> Im trying to get $q to be populated with common or agent.

echo '/home/brent/cgi-bin/scripts/common/ticktaktoe' |perl -wnle'
  m# .* / ( [^/]+ ) / #x;
  print $1;
'
common

-- 
Affijn, Ruud

"Gewoon is een tijger."


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to