in reply to Search and replace within a file

You don't show the code where you get $uname, but five bucks says it's because `uname -r` is returning a string with a newline on the end, and you aren't chomping it, so it doesn't match when that string is followed by more text. It does work when the text in question happens to be the last text on a line, because in that case it is followed by a newline.

Aaron B.
Available for small or large Perl jobs; see my home node.

Replies are listed 'Best First'.
Re^2: Search and replace within a file
by muizelaar (Sexton) on May 08, 2012 at 13:27 UTC

    Guess what?

    Where would you like me to send your five bucks to?

    You were absolutely correct as soon as I chomped the $uname it started working, thanks so much for this it’s been driving me mad. I’m learning all the time.