Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > what exactly do you need to escape? (I can never get this straight)

Reply
Thread Tools

what exactly do you need to escape? (I can never get this straight)

 
 
Steve Grazzini
Guest
Posts: n/a
 
      07-16-2003
Steve <(E-Mail Removed)> wrote:
> As the topic says, what exactly do you need to escape? I can
> never get this straight. For instance, I see this line of code
> when reading through the newsgroups:
>
> unlink glob "$jukebox[$i]/$date/*" or die "Cannot unlink files: $!";
>
> but I am always escaping the forward slash as \/.


You never *need* to escape slash. The only time you might want
to escape it is inside a quote-like operator that has used it for
the quote-character:

next if /$jukebox[$i]\/$date/;

But instead of escaping it there, you'll usually just pick a
different quote-character.

next if m|$jukebox[$i]/$date|;

To answer the more general question:

The list of what counts as a metacharacter and where is in the
"Quote and Quote-like Operators" section of perlop.

% perldoc perlop
% perldoc -f quotemeta

--
Steve
 
Reply With Quote
 
 
 
 
Steve
Guest
Posts: n/a
 
      07-16-2003
Hi all,

As the topic says, what exactly do you need to escape? I can never get
this straight. For instance, I see this line of code when reading
through the newsgroups:

unlink glob "$jukebox[$i]/$date/*" or die "Cannot unlink files: $!";

but I am always escaping the forward slash as \/.

Thanks in advance,

Steve
 
Reply With Quote
 
 
 
 
Steve
Guest
Posts: n/a
 
      07-16-2003
Hey, thanks Steve for the info!


 
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
You've never seen it before and you'll never see it again. Fred A Stover Computer Support 7 12-26-2007 03:33 AM
XML Schema never-never occurence of declared elements / attributes Soren Kuula XML 1 12-01-2005 01:27 PM
string routines go to never never land on unix Kevin C Programming 4 10-17-2003 06:07 PM
Re: Win98 CD is NOT bootable! never was-never will be :-) Pikoro A+ Certification 1 07-05-2003 11:02 PM
Re: Win98 CD is NOT bootable! never was-never will be :-) Andrew Tang A+ Certification 0 07-05-2003 08:23 AM



Advertisments