http://www.perlmonks.org?node_id=194131


in reply to file data

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"