codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  substitution using vars containing $1  mimir at 09:54 on Tuesday, October 02, 2007
 

$sub = "(\w)";
$sub_with = "\U$1";
$text = "Hi hi, i am here.";
$text =~ s/(\w)/\U$1/gi; #this works.
$text =~ s/$sub/$sub_with/gi;#this doesnt work.

#does anybody know why?


  Re: substitution using vars containing $1  mimir at 15:00 on Wednesday, October 03, 2007
 

#got the answer, it is:

#!/usr/bin/perl

$text = $text2 = "Hi hi, i am here.";
$sub = '(\w)';
$sub_with = '\U$1';
$text =~ s/(\w)/\U$1/gi;
eval("\$text2 =~ s/$sub/$sub_with/gi");

print STDOUT "";










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: How to open a MS Word document from Javascript
•  controlling an app in foreground from one running in background
•  Re: Plz its urgent:validation code
•  Carrying Value of Checkbox
•  problem in unzipping the zip files
•  Re: substitution using vars containing $1
•  frameElement question
•  What is the problem with this macro
•  Rewrite this program with good style


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007