RE: finding variable name in string

2003-01-14 Thread Dan Muey
IL 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

Re: finding variable name in string

2003-01-14 Thread Rob Dixon
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 bee

RE: finding variable name in string

2003-01-14 Thread Dan Muey
xon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 9:48 AM To: [EMAIL PROTECTED] Subject: Re: finding variable name in string Hi Dan "Dan Muey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... That's the idea but the prob

Re: finding variable name in string

2003-01-14 Thread Rob Dixon
"Dan Muey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I would think, and have been trying : > $line =~ /\$myVariable/ > If I do $line like this : That's exctly right. > $line = 'HI $myVariable'; > If($line =~ /\$myVariable/) { print "HI"; } > It works

RE: finding variable name in string

2003-01-14 Thread Dan Muey
ary 14, 2003 9:44 AM To: [EMAIL PROTECTED] Subject: RE: finding variable name in string From: "Dan Muey" <[EMAIL PROTECTED]> > Thanks for the reply. > > To simplify the question and not get off track I need to see if a > string contains a variable 'name' n

Re: finding variable name in string

2003-01-14 Thread Rob Dixon
Hi Dan "Dan Muey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... That's the idea but the problem is is that @ row seems to transalet itself into 'print userrname; and print > mysecretpassword;' so that when it checks to see if it contains that string '$password'

Re: finding variable name in string

2003-01-14 Thread Rob Dixon
Hi Ben "Ben Siders" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I believe that what he's after is a RE that will match the name of a > variable proceded by a dollar sign. > > I.E., given this: > > $foo = "bar"; > > if ( $var =~ // ) { print "true" } > > He w

RE: finding variable name in string

2003-01-14 Thread Dan Muey
yVariable"; Which is actually "HI whatevermyvariablecontains" That's the dilemma. -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 9:40 AM To: [EMAIL PROTECTED] Subject: Re: finding variable name in string Hi Ben You&#

RE: finding variable name in string

2003-01-14 Thread Jenda Krynicky
From: "Dan Muey" <[EMAIL PROTECTED]> > Thanks for the reply. > > To simplify the question and not get off track I need to see if a > string contains a variable 'name' not 'value'. I guess we all got lost in what's the actuall variable name, what's to be interpolated when ad so forth. Let's try s

Re: finding variable name in string

2003-01-14 Thread Rob Dixon
Hi Ben "Ben Siders" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I believe that what he's after is a RE that will match the name of a > variable proceded by a dollar sign. > > I.E., given this: > > $foo = "bar"; > > if ( $var =~ // ) { print "true" } > > He w

RE: finding variable name in string

2003-01-14 Thread Dan Muey
Exactly! The problem is is that $var conatins '$foo' but it sees it as having 'bar'. Thanks for helping me clarify. -Original Message- From: Ben Siders [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 9:36 AM To: Rob Dixon Cc: [EMAIL PROTECTED] Subject:

Re: finding variable name in string

2003-01-14 Thread Rob Dixon
Hi Ben You're not soing what you think you're doing. See below. "Ben Siders" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > To expand, I wrote a brief sample program to figure this out, since I > actually had no idea how to do it. Here it is: > > #!/usr/bin/p

RE: finding variable name in string

2003-01-14 Thread Dan Muey
time. I do appreciate it. I'm also trying stuff on this end so I'll post here if I figure it out. Thanks Dan -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 9:31 AM To: [EMAIL PROTECTED] Subject: Re: finding variable name in string

Re: finding variable name in string

2003-01-14 Thread Ben Siders
I believe that what he's after is a RE that will match the name of a variable proceded by a dollar sign. I.E., given this: $foo = "bar"; if ( $var =~ // ) { print "true" } He wants the expression to evaluate true if $var contains the string $foo; that is, the character '$' followed by 'f' 'o'

Re: finding variable name in string

2003-01-14 Thread Rob Dixon
Hi Dan Not clear what your problem is. This works, is it representative? my @row = ('print $user;', 'print $password;' ); foreach (@row) { print $_; print ( /\$password/ ? "\t# Invalid" : "\t# OK"); print "\n"; } Cheers, Rob "Dan Muey" <[EMAIL PROTECTE

Re: finding variable name in string

2003-01-14 Thread Ben Siders
for the 'value' of $variable? I need it to find the actual string '$variable' not what $variable contains. Any other ideas? -Original Message- From: Paul Johnson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 9:12 AM To: Dan Muey Cc: Jenda Krynicky;

Re: finding variable name in string

2003-01-14 Thread Ben Siders
-- From: Paul Johnson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 9:12 AM To: Dan Muey Cc: Jenda Krynicky; [EMAIL PROTECTED] Subject: RE: finding variable name in string Dan Muey said: To simplify the question and not get off track I need to see if a string contains a var

RE: finding variable name in string

2003-01-14 Thread Dan Muey
n Muey Cc: Jenda Krynicky; [EMAIL PROTECTED] Subject: RE: finding variable name in string Dan Muey said: > To simplify the question and not get off track I need to see if a > string contains a variable 'name' not 'value'. > > If($string =~ m/\$variable/) { print

RE: finding variable name in string

2003-01-14 Thread Paul Johnson
Dan Muey said: > To simplify the question and not get off track I need to see if a string > contains a variable 'name' not 'value'. > > If($string =~ m/\$variable/) { print "Yes \$variable exists"; } Don't escape the $ in the RE. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To

RE: finding variable name in string

2003-01-14 Thread Dan Muey
) { print "NO way pal \n"; } # ie if $code contains the string '$password' then don't do it! else { ... Why not just hard code that in you ask? Because this needs to be very very flexible and do almost anything. Some of the more common tasks I've created subroutines

Re: finding variable name in string

2003-01-13 Thread Jenda Krynicky
From: "Dan Muey" <[EMAIL PROTECTED]> > Sorry to bother but... > I have a script that I have to do an eval on code that someone else > has put in a database. ... Are you sure you want to do that? Are you sure you want them to be able to run any code they with inside your script? Deleting files th