Could you please give me a little explanation on the above code? I am not sure what some of it does.
I am guessing the $^I is pretty much the same as the -i switch when editing a file on the command line with the substitute command.
I know what while(<>) does.
The area that i am really getting fuzzy with is with the if statement. I know the first part looks for a line starting with pageroncall:, but the rest is greek to me. Could you please explain this to me?
Correct, $^I is the same as -i.
if(/^pageoncall: \d+(\Q@pager.com\E)/) {
the "if" condition is a regexp that finds the line that starts wih "pageoncall:" followed by a space and one or more digits: \d+. This part (\Q@pager.com\E) captures the email address
and stores it in $1.
\Q tells perl to escape meta characters like @ and . in the string so they are treated as literal characters, the \E tells perl to where to stop escaping meta characters.
The next line replaces the new number with the old and reprints the line back into the file.
print "pageoncall: $num$1\n";
the other 'print' line just prints the rest of the lines back into the file.
Did it work?