> On Fri, 8 Aug 2003 22:16:38 -0400 (EDT), perlwannabe wrote: >> I tried both the suggested methods without success. But, I mightuv >> found a problem. I tried all of these methods with no success and >> looked at the input file "listitems.txt" and found something >> interesting when using a hexeditor. Each line ends with 0D0A, so in a >> hex editor the previous file looks like: > okay... in ascii the hex of 0d0a works out to character #13 and #10 > which works out to CR and LF. > > CRLF is the normal Carriage Return Linefeed that is used to separate > lines on windows. > > It seems that everybody here pointed you into the right direction... > but there seems to be something else wrong than the provided code (or > your code for that matter). It seems that the data you use is the > problem. > > To really find out what the problem is... you need to learn how to > debug your code. A starting point would be: > > perldoc perldebtut<Return> > or > perldoc perldebug<Return> > > you should type that on the dos/command prompt in windows. > > Add the following lines to your program under the perl location line: > > use warnings; > use diagnostics; > use strict; > > It will check automatically for stractural errors that are often made > and will give you (hopefully) meaningful error/warning messages. > > Another thing to do is to print everything to the screen. > > You define a variable? Print it. > You use a variable? Print it before it's use and after it's use. > > BTW. Write at first in PSEUDOCODE and than translate it into perl. (I > will add comments instead) > <SNIP, SNIP>
Oliver, thank you for the response. I did indeed comment every single variable, but deleted it from my sample script for simplicity. I have been wrestling with this problem for a while. I did run your code and got the following error: C:\testdir>perl testfile.pl listitems.txt item997 *item997*.* c:/testdir/*item997*.* Uncaught exception from user code: unlink failed: at testfile.pl line 27, <FH> line 1. You mention a "perl location line" what is that? Is there something I have to declare for the program to work? I read something about File::glob but I don't think that has anything to do with it. BTW...I have also hard coded the location as follows: $location = 'c:/testdir/*item997*.*'; unlink glob $location; THIS WORKS!!! That is why this stupid problem is killing me. I can write a script that will get me the location 'c:/testdir/*item997*.*' by using variables, but when I try to unlink the program bombs. You can see by the printout of your script that it is indeed returning "c:/testdir/*item997*.*" for your variable $complete, but for whatever reason, it won't unlink $complete. It doesn't even continue to process the remaining lines in the file, it bombs after reading the first line of 'listitems.txt' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]