In the following code I am trying to substitute Fred for Barney, then capitalize Barney and then output it to screen. I can do the initial substitution but when I add a second substitution the output isn't what I want.
#! /usr/bin/perl use v5.14; use warnings; $_ = "He's out bowling with Fred tonight."; s/Fred/Barney/; s/with (\w+)/against $1's team/; #This is the line of code that screws up ouptut s/$1/\U$1/gi; print "$_\n";
In reply to Having issues with substitutions by catfish1116
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |