How can I replace a string in Perl?

Viewed 15062

I am trying to do a simple string substitution, but could not succeed.

#!/usr/bin/perl

$var = "M4S120_appscan";
$var1 = "SCANS";

$path =~ s/$var/$var1/;

print "Path is $path"

The output should be "Path is SCANS", but it prints nothing in 'output'.

3 Answers
Related