Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: unlink fails to delete files with perculiar names

by stefbv (Deacon)
on Nov 22, 2011 at 08:57 UTC ( #939391=note: print w/replies, xml ) Need Help??


in reply to unlink fails to delete files with perculiar names

Quote the argument of unlink.

my($no) = unlink "$targ" || carp "Unable to delete file $targ\n";

Replies are listed 'Best First'.
Re^2: unlink fails to delete files with perculiar names
by salva (Abbot) on Nov 22, 2011 at 09:05 UTC
    Putting the variable inside quotes is useless in this context.

      I think it is not useless it's about dealing with spaces in file names.

      Update: Sorry, made some further tests and I was wrong.

        The only effect of putting some var inside quotes is to convert it into an string but Perl already does that for your implicitly most of the times.

        It only makes a difference in those rare cases where the internal representation of the variable determines what to do. For instance, the given construction in Perl 5.10 uses different comparisons when the internal representation of the scalar is a number or a string (and it is currently considered broken because of that).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://939391]
help
Chatterbox?
[Corion]: Oooh - I had another devious idea - "Host C" - a C language where every struct is 4K in size. This makes memory and disk access incredibly fast ;)
[Corion]: (because everything is aligned to a memory page and all pages can be read+written directly from disk without buffering)

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-04-25 09:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (449 votes). Check out past polls.