in reply to file data
- do you see the problem here?
yes, you are missing use strict; and use warnings; from the top of your script. If you were to have these included then you would find out that you have a typo in your regex: $baseDir is not defined - it should be $subdir - and your filehandle <data> is invalid - it should be <DATA>.
other than that your code works as you expect
larryk perl -le "s,,reverse killer,e,y,rifle,lycra,,print"
In Section
Seekers of Perl Wisdom