What environment are you running in? "Command line" is pretty vague.
A few pointers here:
is a great way to start a script in Perl since without them Perl won't complain much about what you are doing other than gross syntax errors. With the strictures in place you get told about more subtle issues that can help you get your code working the way you expect it to.
open THING,"<some_file.ext" or die "some_file.ext:$!";
open OTHERTHING,">some_other_file.ext" or die "some_other_file:$!";
In my humble opinion the one of the ten commandments of programming in any language is "Thou Shalt Catch Errors." Catching errors is another great step towards programming nirvana where you code does what you expect. There could very well be permission issues either reading a file or writing a file. Your code may not be executing where you think it is. All this and more can cause you issues.
Finally: what are you expecting your code to do in the first place? What does your input look like?
Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg