Re: 2 dimentional data call within a conditional
- From: fzxdf5@xxxxxxxxx
- Date: Fri, 29 Jun 2007 07:13:17 -0700
On Jun 28, 4:49 pm, "J. Gleixner" <glex_no-s...@xxxxxxxxxxxxxxxxxxxxx>
wrote:
fzx...@xxxxxxxxx wrote:
Greetings,
I am trying to get this snippet to run...but it fails at the
conditional "if" portion.
What fails?
I think the problem lies in the ...m/\$data[$r][0]\b/...build
portion. I've even 'built" the search expression around a non-arrayed
variable with no luck
No idea what a 'build portion' is..
What am I doing wrong?
use strict;
use warnings;
@data= ( ["junk",3,1,3,4], ["trash",4,2,3,4,6] );
@money = ( "junk", "trash");
for ($r=0; $r<2; $r++)
{
if ($money[$r] =~ m/\$data[$r][0]\b/ )
^ no need to escape the '$'.
if ($money[$r] =~ m/$data[$r][0]\b/ )
Why use a match at all??
if( $money[ $r ] eq $data[$r][0] )
{
print "data[$r][0] = $data[$r]->[0];
print "data[$r][0]=$data[$r][0]\n";
}
}- Hide quoted text -
- Show quoted text -
Thank you for your quick reply...I see what you mean with a complete
field match. This pointed out an error in my provided snippet of what
I'm trying to extract from the array
In my original snippet...I made an error in my $data line
presentation...it should have read
@data= ( ["crushed junk car",3,1,3,4], ["green trash can",
4,2,3,4,6] );
where I'm searching for a string segment in the first array position.
Sorry about this oversite.
.
- References:
- 2 dimentional data call within a conditional
- From: fzxdf5
- Re: 2 dimentional data call within a conditional
- From: J. Gleixner
- 2 dimentional data call within a conditional
- Prev by Date: Simple fork examples
- Next by Date: Re: date parts in one step
- Previous by thread: Re: 2 dimentional data call within a conditional
- Next by thread: localtime and mktime
- Index(es):
Relevant Pages
|
|