[ale] Perl question

Terry Bailey terry at bitlinx.com
Wed Apr 11 20:37:38 EDT 2007


Hi,

I want to use a Perl script to remove just the files that end in x, 
so I wrote the following, but it deletes every file in the 
directory.  What am I not seeing?   This afternoon, I got tired of 
using nano and started using wordpad.  Do you think there is an 
embedded character that doesn't show?






$x = "x";
open(INPIPE, "ls /cygdrive/D/ftproot/abc -1pt | grep -v / |");
while ($hold = <INPIPE>){
chomp($hold);
$tmp = $hold;
$right = chop($hold);
if ($x eq $right){system("rm /cygdrive/d/ftproot/abc/$tmp");}
}
close(INPIPE);

Thanks,

Terry Bailey

-------------- next part --------------
An HTML attachment was scrubbed...




More information about the Ale mailing list