Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: unlink($ful) does not delete

by tcf03 (Deacon)
on Dec 07, 2007 at 11:52 UTC ( #655624=note: print w/replies, xml ) Need Help??


in reply to unlink($ful) does not delete

#!/usr/bin/perl use strict; use warnings; my $thef = "f"; my $ful="../../../".$thef; print "$ful\n"; unlink($ful) or die "unable to delete $ful: $!\n"
Works fine for me. try printing param(f) and $ful before you unlink.

Ted
--
"That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
  --Ralph Waldo Emerson

Replies are listed 'Best First'.
Re^2: unlink($ful) does not delete
by daithimcc (Novice) on Dec 07, 2007 at 17:58 UTC
    No - that works fine for me if "f" was the name of the file. The name of the file is passed to the script from the browser:www.mydomain.com/..../ dfil?f=abcde
    In the script I then pick up the name of the file with
    $thef=param('f');
    when I print $thef everything appears the same abcde as if I had written $thef="abcde"; printing $ful gives the path exactly as it should be - it can even be recognised by -e $ful but it is not recognised by unlink($ful)
    So although they appear identical strings unlink recognises it when $thef was manually set $thef="abcde" but not when set using the parameter $thef=param('f'); even though they look identical and behave identically for -e
    I even tried chomp($thef);

    Thanks again for any help!
      Did you try printing them? Can you post more of the code itself?

      also adding

        use CGI::Carp qw(fatalsToBrowser);

      to the top of your program may prove useful.

      update

      And then in your code: die unless param('f');

      Ted
      --
      "That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
        --Ralph Waldo Emerson

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://655624]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2022-05-28 01:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (98 votes). Check out past polls.

    Notices?