Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://939391]
[james28909]: i dunno, if i didnt have so little experience in linux i would swap. but it would be to much of a learning curve for me right now.
[choroba]: Low-end is defined as the Perl that generates millions of income
[choroba]: sorry, that's high-end, of coursse
[choroba]: low end, in my talk, will be code that "we don't touch because it works" and noone knows why
[choroba]: I want to present the most bizzare bugs and misfeatures I met when working for a large financial institution
[choroba]: I already gave a similar talk to my friends in a pub and at an internal conference at work and people liked it, so maybe...
[choroba]: LanX: That's the heritage, I can't do anything else
[RonW]: Sounds like some system my employer has "It does exactly what we need it to do and can't afford to risk anything we can't prove is 100% compatible"
[marto]: choroba sounds interesting
[RonW]: james28909 Why not write a Perl program to do the task?

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (11)
As of 2017-05-22 21:37 GMT
Find Nodes?
    Voting Booth?