--- On Fri, 11/7/08, Brent Clark <[EMAIL PROTECTED]> wrote:

> From: Brent Clark <[EMAIL PROTECTED]>
> Subject: Regex path
> To: beginners@perl.org
> Date: Friday, November 7, 2008, 1:46 PM
> Hiya
> 
> I have some paths like so.
> 
> /home/brent/cgi-bin/scripts/common/ticktaktoe
> /home/brent/cgi-bin/scripts/agent/ticktaktoe
> 
> 
> Im trying to get $q to be populated with common or agent.
> 

use File::Basename;
my $path = dirname("/home/brent/cgi-bin/scripts/common/ticktaktoe");

my ($var) = $path =~ /.*\/(.+)$/;


      


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


Reply via email to