regex to change second variable

I

incognito

I've read the camel book. I've searched newsgroups. I can't find the
answer.
I seems like this should be simple and common, but I'm stumped.

Here's what I'm trying to do:

my $image="/u/bk/edieusqa01.tgz";

I want to create a new variable, based on $image:

my $md=($image =~ s/edie/md5.edie/);

But, it changes $image instead of creating $md.

What I want at the end is:

$image="/u/bk/edieusqa01.tgz";
$md="/u/bk/md5.edieusqa01.tgz";

I'm having to do it the following way, but it seems like it should be
able to be done on one line:

my $image="/u/bk/edieusqa01.tgz";
my $md=$image;
$md =~ s/edie/md5.edie/;

Help!
 
G

Gunnar Hjalmarsson

incognito said:
my $image="/u/bk/edieusqa01.tgz";

I want to create a new variable, based on $image:

my $md=($image =~ s/edie/md5.edie/);

( my $md = $image ) =~ s/edie/md5.edie/;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top