http://qs321.pair.com?node_id=187901


in reply to Re: shell problem
in thread Trying to convert shell script to Perl

I don't think this approach will work any better than what the seeker posted. The problem is that the values being assigned to "$DIR" all have the line-termination character(s) attached (/[\r\n]+/), whereas this was not the case for the original shell script. You either have to "chomp $DIR" or else use the "opendir()" and "readdir()" calls, as demonstrated by DDA below.