in reply to regex on path

You should follow aufrank's advice, or use split. For example:

my $DRIVENAME = (split /\//,$ENV{PWD})[1] ;

Or, if you want to keep on with awk, you should just put in your backticks:

pwd | awk -F/ '{ print $2 }'

With -F/ you are stating that the separator is slash, and you are printing the second field (the first -that is: what comes before the first slash- is empty)

Anyway, I strongly descourage you to do so: it's a task that Perl can easily accomplish without spawning any external process, so why do it?

Ciao!
--bronto

# Another Perl edition of a song:
# The End, by The Beatles
END {
  $you->take($love) eq $you->made($love) ;
}

Replies are listed 'Best First'.
Re: Re: regex on path
by Sara (Acolyte) on Aug 06, 2002 at 16:37 UTC
    thanks