Ok I finally took the two seconds it takes to set 
my mail program to reply better so I can avoid top posting!
Hope everyone is happy about that! ;)

> -----Original Message-----
> From: Rob Dixon [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, January 14, 2003 10:31 AM
> To: [EMAIL PROTECTED]
> Subject: Re: finding variable name in string
> 
> 
> Dan
> 
> > I think that's exactly whatI'm doing wrong.
> >
> > I think what's Jenda has been trying to get across to my 
> little brain 
> > all
> along.
> >
> > Thw way I'm doing it is this
> >
> > $string = "$row[2] $row[4] $row[5] $row[3]";
> > If ($string ....
> >  But $string is already interpolated!
> >
> > What Jenda has been saying is
> >
> > Foreach $item(@row) {
> > if( $item ....
> >
> > The regex isn't the problem it's the interpolation by adding those
> elements to a variable and checking it.
> >
> > I'll just rewrite it to do it that way.
> >
> 
> I still doubt if that'll get you anywhere I'm afraid. You 
> see, Perl will interpolate only one level at a time, and as 
> far as I know the only way to interpolate further is to use 
> an eval. Look at this:
> 
>     my ( $user, $password ) = qw ( Rob SECRET );
>     my @row = ( 'print $user;', 'print $password;' );
> 
>     my $string = "$row[0] $row[1]";
> 
>     print "$string\n";
>     print eval qq["$string"]."\n";
> 
> output
> 
>     print $user; print $password;
>     print Rob; print SECRET;
> 
> See what I mean? And I doubt if you've been doing anything 
> like that. That's why I think you should print your @row 
> array as early as possible to see what you actually have. I 
> believe the code you have is correct and the problem is earlier on.
I see! Well that may have saved me time in trying one way. 
I'll definitely look into that.
> 
> I'll leave you alone now! Good luck!
> 
No bother I swear! I really appreciate any input I can get.
Thanks!

Dan
> Rob
> 
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to