On 4/25/07, John W. Krahn <[EMAIL PROTECTED]> wrote:

Nishi wrote:
> Hi:

Hello,

> What is the equivalent of basename? Ie if I dont want to use basename
> package to get the filename off a path, what reg expr can i use in perl?
>
> Would this work --
> my $fileName=$path =~ /.*\/(.+)$/;

Assuming that your file system uses / as the path separator:

( my $fileName = $path ) =~ s!.*/!!;



Hi, is there a way that I can take into consideration the "\" as well as "/"
ie
if os= windows, then do something
else
do something else

John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall

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



Reply via email to