Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: unlink($ful) does not delete

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


in reply to unlink($ful) does not delete

One more comment

   Also I can test if the file exists, using the variable, -e $fnmi and I get true.

Its not obvious from your code where this variable comes from, but the existance of a variable and the contents are two different things. You'll get more mileage with something like:

  • if ( $fnmi eq 'someword' ) { # do stuff }
  • if ( $fnmi =~ /^someword$/  ) { # do stuff }


  • 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 18:13 UTC
      Also I can test if the file exists, using the variable, -e $fnmi and I get true.
      Sorry that was a mistake
      Should have been -e $ful
      I believed that this was testing the existence of a file whose path is contained as a string in the variable.
      As a matter of interest what is the significance of this construction:
      ( $fnmi =~ /^someword$/ )?
      Thanks
        As a matter of interest what is the significance of this construction: ( $fnmi =~ /^someword$/ )?

         ( $fnmi =~ /^someword$/ ) is a pattern match, which happens to be equivalent to  ( $fnmi eq 'someword' ).

        To understand why so, start reading about regular expressions and matching in perlrequick, and read more in perlretut and perlre.

        Rudif

          Thanks for the direction. That's the next thing I needed to find out about.

    Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (7)
    As of 2022-05-19 21:48 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Do you prefer to work remotely?



      Results (72 votes). Check out past polls.

      Notices?