Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Help Required !!!!

Reply
Thread Tools

Help Required !!!!

 
 
vandana
Guest
Posts: n/a
 
      06-23-2006
Hello,

# strip (trailing) filename from path, leaving directory only

my ($path) = $ENV{'PATH_TRANSLATED'} =~ m|(^.*)\\|;

It removes trailing filename from path. Can anyone help me to
understand the working of
m|(^.*)\\|; in above command.

Regards
Vandana

 
Reply With Quote
 
 
 
 
David Squire
Guest
Posts: n/a
 
      06-23-2006
vandana wrote:
> Hello,


Hello Vandana,

Welcome to this group. Might I suggest that a good starting point for
you would be to read the posting guidelines that are posted here several
times a week. In particular, they give advice on how to maximize your
chances of getting a useful response, by doing such things are using a
meaningful subject line for your post.


>
> # strip (trailing) filename from path, leaving directory only
>
> my ($path) = $ENV{'PATH_TRANSLATED'} =~ m|(^.*)\\|;
>
> It removes trailing filename from path. Can anyone help me to
> understand the working of
> m|(^.*)\\|; in above command.


You need to read Perl's documentation on regular expressions, and the
match and substitution operators that use them. Perl comes with its
documentation included. You can access it using the perldoc command on
the command line. Try "perldoc perlre", "perldoc perlop", and "perldoc
perlretut". You can also read the documentation online at
http://www.perl.com/pub/q/documentation

Regards,

DS
 
Reply With Quote
 
 
 
 
cartercc@gmail.com
Guest
Posts: n/a
 
      06-23-2006
vandana wrote:
> Hello,
> It removes trailing filename from path. Can anyone help me to
> understand the working of
> m|(^.*)\\|; in above command.


m # matches the left value
| # the delimiter for the regular expression
( # beginning of whatever is saved
^ # matches the beginning of the line
.. # matches any character up to whatever follows
* # matches greedily any number of characters from zero upward
) # ends the recording of charachter - paired with the opening parens
\ # the escape character
\ # the character escaped, possibly a Windows path delimiter
| # the delimiter of the regular expression - paired with the opening
pipe
; # ends the expression

Suggest you sit down with the Perl documentation and read the pages on
regular expressions.

CC

 
Reply With Quote
 
John W. Krahn
Guest
Posts: n/a
 
      06-23-2006
vandana wrote:
>
> # strip (trailing) filename from path, leaving directory only


You probably want to use the File::Basename::dirname function for that:

perldoc File::Basename


John
--
use Perl;
program
fulfillment
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      06-23-2006
vandana wrote:

Please put the subject of your post into the Subject of your post

> # strip (trailing) filename from path, leaving directory only


There are ready-made modules for that task (See File::Basename) which are
tried and proven and work regardless of the platform used.

> my ($path) = $ENV{'PATH_TRANSLATED'} =~ m|(^.*)\\|;
>
> It removes trailing filename from path.
> Can anyone help me to
> understand the working of
> m|(^.*)\\|; in above command.


See perldoc perlop for the 'm' operator.
See perldoc perlretut and perldoc perlre for the RE.

jue


 
Reply With Quote
 
krakle@visto.com
Guest
Posts: n/a
 
      06-23-2006

vandana wrote:
> Subject: Help Required !!!!!


Help is required... It's optional...

 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      06-23-2006
vandana <(E-Mail Removed)> wrote:

> Subject: Help Required !!!!



You will get more people to help if you compose a meaningful
Subject line.

Every post here requires help. Do you think that question-answerers
read every post? They don't. They read the ones with interesting
subjects, which your's isn't.

Please see the Posting Guidelines that are posted here frequently.


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a VD with required properties on a required Web Server (Windows Advanced Server 2000 has 3 Web Servers) Just D. ASP .Net 0 03-10-2006 06:02 AM
Help Required for Help Context Id !!!!!! SenthilVel ASP .Net 4 12-14-2005 11:48 AM
PLEASE HELP, Techie Help desperately required... David Dean Computer Support 6 10-31-2005 01:04 PM
Thunderbird: Newsgroup settings - help required please Morgan Firefox 1 04-01-2005 01:44 PM
help pls. textbox required only when checkbox is checked (help with validation) Emiliano ASP .Net Web Controls 2 10-16-2003 09:09 PM



Advertisments