troy222 has asked for the wisdom of the Perl Monks concerning the following question:
Am I missing something here? If you can enlighten me, it will be greatly appreciated. Regards Troysub rpt_parsetoken($$$$$) { my ($rptsql,$n,$sd,$ed,$d) = @_; my $newval; while ($rptsql =~ m/{(\w+)}/) { print "token : $&\n"; my $token = $&; my $newval; my $streval; if ($1 eq 'node') { $newval = qq{$n}; } elsif ($1 eq 'startdate') { $newval = qq{$sd}; } elsif ($1 eq 'enddate') { $newval = qq{$ed}; } elsif ($1 eq 'date') { $newval = qq{$d}; } print ("getting value from token: ".$newval."\n"); print (" eval = $streval\n"); #eval $streval; $rptsql =~ s/{$token}/'$newval'/; } print $rptsql."\n"; return $rptsql; } sub test($) { my ($str) = @_;#q{ this is nothing to $fess about}; my $nstr; #while ($str =~ m/##\w+##/) { while ($str =~ m/\$\w+/) { my $token = $&; print "original: $str\n"; print "token: $token\n"; $token = "\\".$token; print "modified token : $token\n"; my $newval = qq{'wierd'}; $str =~ s/$token/$newval/; print "patched: $str\n"; } } output from solaris 9 + perl 5.8.3: ----------------------------------- token : {node} getting value from token: dws2 '/val = $rptsql =~ s/$token/'dws2 'elect 1, 2 from RECON_SAP_DATA where DWS_NODE = 'dws2 '0080910-07:26:21 : preparing sql: select 1, 2 from RECON_SAP_DATA whe +re DWS_NODE = 'dws2 output from windows + perl 5.10: --------------------------------- token : {node} getting value from token: dws2 eval = $rptsql =~ s/$token/'dws2'/ 20080910-12:42:44 : preparing sql: select 1, 2 from RECON_SAP_DATA whe +re DWS_NODE = 'dws2' for some reason the ' is getting shuffled around to start of the strin +g
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl 5.10 & perl 5.8.3 solaris
by moritz (Cardinal) on Sep 10, 2008 at 06:12 UTC | |
by troy222 (Initiate) on Sep 11, 2008 at 08:41 UTC | |
|
Re: Perl 5.10 & perl 5.8.3 solaris
by Mutant (Priest) on Sep 10, 2008 at 10:30 UTC |