Testing your code, my testfiles were altered. I had a .bak file containing the old content and the "original" file was empty.
You lack a print statement in you while loop to print the file contents.
#!/usr/bin/perl -w use strict; $^I = ".bak"; while (<>) { if (/^#!/) { # BE AWARE OF THE NEWLINE $_ .= "## Copyright (C) 2008 by C'est Mois\n"; } # BEWARE THIS: prints $_ print; }
In reply to Re: Regex not working
by linuxer
in thread Regex not working
by bluethundr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |