Can't you regex out anything that comes before the $ in $var, and then proceed from there? Maybe I'm missing something here ...
$var='1>>$fileName'; # This is coming from your first perl script, right? $filename="File1"; $var=~s/.*(\$\S+).*/$1/; # Now $var eq '$fileName'; $string=eval($var); Pete Mar 18, 2003 at 11:26am from Navid M.: NM> Thanks Pete, I actually thought about this, but NM> because of the format of my perl script, it'll get too NM> messy if I do this with a regex. The thing is, If I NM> didn't have any other string other than the filename, NM> then this would have been really easy to do. Ex: NM> NM> $fileName = "File1"; NM> $var = '$fileName'; NM> NM> $string = eval($var); # $string now stores 'File1'. NM> NM> But this won't work if $var='1>>$fileName'. I was NM> hoping there would be a simple way getting around this NM> without using any regexps. NM> NM> Navid M. NM> NM> --- Pete Emerson <[EMAIL PROTECTED]> wrote: > NM> Your first perl script sends '1>>$filename' (single NM> > quotes, this is NOT a NM> > variable) ... and you want to replace '$filename' NM> > with the contents of the NM> > variable $filename? NM> > NM> > If I have that correct, a regex will help: NM> > NM> > my $string='1>>$filename'; # This is coming from NM> > your first perl script. NM> > my $filename='filename.txt'; NM> > $string=~s/\$filename/$filename/; # Regex! Escape NM> > the $ ... NM> > print "$string\n"; NM> > NM> > Pete NM> > NM> NM> ______________________________________________________________________ NM> Post your free ad now! http://personals.yahoo.ca NM> NM> -- http://emerson.wss.yale.edu/perl Pete Emerson WSS AM&T Yale University -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]