Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple substitution problem

Status
Not open for further replies.

ironpawz

IS-IT--Management
Oct 8, 2002
44
NZ
$cyfgrp[$i] =~ s/\$login\[\$a\]/\$first\[\$a\] \$lastn\[\$a\]/;

I am trying to sub $login[$a] for $first[$a] lastn[$a] in $cyfgrp[$i]. I know there is a mistake here but I'm haing trouble figuring it out.

Thanks
 
ran into a similar problem in one of my own scripts. gotta put \Q infront of your variables:

$cyfgrp[$i] =~ s/\Q$login\[\Q$a\]/\Q$first\[\Q$a\] \Q$lastn\[\Q$a\]/;

I think that's right...
 

I got it working actually I took out all the \ I think they where making the special characters literal so I ended up with.

$cyfgrp[$i] =~ s/$login[$a]/$first[$a] $lastn[$a]/;

Which worked fine.

Thanks for the suggestion thought!





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top