problem using -f file operator



Hello,

I am trying to use the -f operator in the following manner:

# some $item manipulation here
.....
if ( -f $item )
{
unlink($item) || carp "Warning: couldn't remove file:
'$item'\n$!";
carp "Remove File: $item \n" if $debug;
}
elsif ( -d $item )
{
rmtree($item) || carp "Warning: couldn't remove dir:
'$item'\n$!";
carp "Remove Dir: $item \n" if $debug;
}
elsif ( -e $item )
{
unlink($item) || carp "Warning: couldn't remove item:
'$item'\n$!";
carp "Remove Item: $item \n" if $debug;
}
else
{
carp "Ignore Item: $item\n" if $debug;
}

the problem is that for a valid file, full path in $item perl doesn't
enter the: if (-f $item)
and I get the: "Ignore Item" message.

I run perl 5.005_03 on unix,
as I mentioned the file exists, using unix file command on it issues:
commands text
The directory is readable & writable to me.
moreover using: perl -e '$item = "/.....Eth_Stum.eu"; unlink($item);'
works!

can anybody see what's wrong here ?

many thanks,

Oded Haim-Langford

.



Relevant Pages

  • Re: problem using -f file operator
    ... > # some $item manipulation here ... > the problem is that for a valid file, full path in $item perl doesn't ... > as I mentioned the file exists, using unix file command on it issues: ... You have a file in your root directory whose name begins with 6 ...
    (perl.beginners)
  • Searching text file and printing to new file
    ... I'm a nearly absolute beginner to Perl, and a lot of the text ... manipulation things confuse me. ...
    (perl.beginners)
  • Of Lisp and little sleep...the little monstrous questions that nag me.
    ... I am currently reading a new Perl book that states that Perl is more ... "Does Tcl also share 6 of the 7 traits that set Lisp apart?". ... He goes on to say that Perl is coded in a "C" manner because it was ...
    (comp.lang.tcl)
  • Re: C language and bioinformatics
    ... Perl is the preffered language for basic bioinformatics programng, ... seqeuence (manipulation) and structure analysis is much more easier in perl ...
    (perl.beginners)
  • Re: why the following HereDoc print dont work?
    ... No other part of perl fails in this manner, ... Ordinary statements are parsed just fine if they ...
    (comp.lang.perl.misc)