Not able to edit multiple files by perl -pi -e!

view story

http://www.linuxquestions.org – Code: perl -pi -e 'print "mango" if (($.==1) && ($_ !~ /#!!/))' flex3.pl new.pl the above command works only for 1st file (flex3.pl) and not for the 2nd file(new.pl) i have tested many times , sometimes giving *.pl in filenames but only the 1st one is getting affected. i think it should work for all the files Let me clarify what i intend to achieve: i want the above command to check 1st line of all the files in the files i provided and then add "mango" if test passes. (HowTos)