Jun 12, 2007 #1 lgeorge26 Programmer Jun 12, 2007 2 FR Is it possible to substitute a variable in s///g; i.e for eg $var="*"; $str="abc1230-9ASA*new"; $str=~ s/$var//g; print $str; output should be abc1230-9ASAnew
Is it possible to substitute a variable in s///g; i.e for eg $var="*"; $str="abc1230-9ASA*new"; $str=~ s/$var//g; print $str; output should be abc1230-9ASAnew
Jun 12, 2007 1 #2 travs69 MIS Dec 21, 2006 1,431 US Not sure if it's the best or brightest way but: $var= '\*'; $str='abc1230-9ASA*new'; $str=~ s/$var//g; print $str; Upvote 0 Downvote
Not sure if it's the best or brightest way but: $var= '\*'; $str='abc1230-9ASA*new'; $str=~ s/$var//g; print $str;
Jun 12, 2007 1 #3 KevinADC Technical User Jan 21, 2005 5,070 US Code: $var = "*"; $str = "abc1230-9ASA*new"; $str =~ s/\Q$var\E//g; print $str; ------------------------------------------ - Kevin, perl coder unexceptional! Upvote 0 Downvote
Code: $var = "*"; $str = "abc1230-9ASA*new"; $str =~ s/\Q$var\E//g; print $str; ------------------------------------------ - Kevin, perl coder unexceptional!
Jun 13, 2007 Thread starter #5 lgeorge26 Programmer Jun 12, 2007 2 FR Any how thank you guys for your help Upvote 0 Downvote