match not matching

Can somebody help me understand this? Given this loop, and the logged 
output following ...

my $found;
for( @$products ) {;
   $found = $$_ =~ m|$project|;
   $dump = Data::Dumper->Dump([$_, $project, $$_, $found]);
   $logger->trace(qq(dump=$dump));
}

I can't explain why $found is not true on the 3rd pass. Does this have 
something to do with the way I'm dereferencing the blessed object?

SVN.Hooks - dump=$VAR1 = bless( do{\(my $o = 'FS1100-S1')}, 
'RPC::XML::string' );
$VAR2 = 'STABLE/FS1100-S3/RSLOGIX_5000/';
$VAR3 = 'FS1100-S1';
$VAR4 = '';
SVN.Hooks - dump=$VAR1 = bless( do{\(my $o = 'FS1100-S2')}, 
'RPC::XML::string' );
$VAR2 = 'STABLE/FS1100-S3/RSLOGIX_5000/';
$VAR3 = 'FS1100-S2';
$VAR4 = '';
SVN.Hooks - dump=$VAR1 = bless( do{\(my $o = 'FS1100-S3')}, 
'RPC::XML::string' );
$VAR2 = 'STABLE/FS1100-S3/RSLOGIX_5000/';
$VAR3 = 'FS1100-S3';
$VAR4 = '';

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com


0
wpmccormick
3/1/2014 5:13:05 AM
perl.beginners 29388 articles. 4 followers. Follow

4 Replies
1026 Views

Similar Articles

[PageSpeed] 47
Get it on Google Play
Get it on Apple App Store

On Feb 28, 2014, at 9:13 PM, Bill McCormick <wpmccormick@gmail.com> =
wrote:

> Can somebody help me understand this? Given this loop, and the logged =
output following ...
>=20
> my $found;
> for( @$products ) {;
>  $found =3D $$_ =3D~ m|$project|;
>  $dump =3D Data::Dumper->Dump([$_, $project, $$_, $found]);
>  $logger->trace(qq(dump=3D$dump));
> }
>=20
> I can't explain why $found is not true on the 3rd pass. Does this have =
something to do with the way I'm dereferencing the blessed object?
>=20
> SVN.Hooks - dump=3D$VAR1 =3D bless( do{\(my $o =3D 'FS1100-S1')}, =
'RPC::XML::string' );
> $VAR2 =3D 'STABLE/FS1100-S3/RSLOGIX_5000/';
> $VAR3 =3D 'FS1100-S1';
> $VAR4 =3D '';
> SVN.Hooks - dump=3D$VAR1 =3D bless( do{\(my $o =3D 'FS1100-S2')}, =
'RPC::XML::string' );
> $VAR2 =3D 'STABLE/FS1100-S3/RSLOGIX_5000/';
> $VAR3 =3D 'FS1100-S2';
> $VAR4 =3D '';
> SVN.Hooks - dump=3D$VAR1 =3D bless( do{\(my $o =3D 'FS1100-S3')}, =
'RPC::XML::string' );
> $VAR2 =3D 'STABLE/FS1100-S3/RSLOGIX_5000/';
> $VAR3 =3D 'FS1100-S3';
> $VAR4 =3D '';


You have inverted the regular expression. You want this:

for( @$products ) {;
 $found =3D $project =3D~ m|$$_|;

0
Jim
3/1/2014 6:26:20 AM
On Fri, Feb 28, 2014 at 11:13:05PM -0600, Bill McCormick wrote:
> Can somebody help me understand this? Given this loop, and the
> logged output following ...
> 
> my $found;
> for( @$products ) {;
>   $found = $$_ =~ m|$project|;

I think you might have meant:
    $found = $project =~ m|$$_|;

>   $dump = Data::Dumper->Dump([$_, $project, $$_, $found]);
>   $logger->trace(qq(dump=$dump));
> }
> 
> I can't explain why $found is not true on the 3rd pass. Does this
> have something to do with the way I'm dereferencing the blessed
> object?

-- 
Paul Johnson - paul@pjcj.net
http://www.pjcj.net
0
paul
3/1/2014 12:19:23 PM
On 3/1/2014 6:19 AM, Paul Johnson wrote:
> On Fri, Feb 28, 2014 at 11:13:05PM -0600, Bill McCormick wrote:
>> Can somebody help me understand this? Given this loop, and the
>> logged output following ...
>>
>> my $found;
>> for( @$products ) {;
>>    $found = $$_ =~ m|$project|;
>
> I think you might have meant:
>      $found = $project =~ m|$$_|;
>
Duh!! Thanks!


---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com


0
wpmccormick
3/1/2014 3:13:17 PM
On 2014-03-01 06:13, Bill McCormick wrote:

>    $found = $$_ =~ m|$project|;

Alternative:

$found = ( index( $project, $$_ ) >= 0 );

or rather use:

$found = $project =~ /\b\Q$$_\E\b/;

Always add escaping and anchors, or you will match the unmatchable.

-- 
Ruud


0
rvtol
3/1/2014 3:26:29 PM
Reply:

Similar Artilces:

[perl6/specs] 8efa3a: Correct Match.start/Match.end -> Match.from/Match....
----==_mimepart_51421864a530e_53794451388849a Date: Thu, 14 Mar 2013 11:35:16 -0700 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-ID: <51421864aceb8_537944513888528@hookshot-fe6-pe1-prd.aws.github.net.mail> Branch: refs/heads/master Home: https://github.com/perl6/specs Commit: 8efa3ac10649401dbbcb6488975bc65d6b501326 https://github.com/perl6/specs/commit/8efa3ac10649401dbbcb6488975bc65d6b501326 Author: Rob Hoelz <rob@hoelz.ro> Date: 2013-03-14 (Thu, 14 Mar 2013) Changed paths: M S28-spe...

howto simplfy this regex if ($string =~/^$match | $match | $match$/g){
------=_NextPart_000_004C_01C8ADE9.8884D110 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Hi, How do I simplify the regex below so that it matches only the number 1, = henceforth it should return false if I match $string with $match. use strict; use warnings; my $string =3D "10 11 12 13 40"; my $match =3D 1; if ($string =3D~/^$match | $match | $match$/g){ print "match"; }else{ print "unmatch"; }; ------=_NextPart_000_004C_01C8ADE9.8884D110-- On Sun, May 4, 2008 at 1:19 AM, &l...

match
$mystring3="abacadeusagaka35"; if($mystring =~ m/(a.+)/g){ print $1,"\n"; } Hi, I wonder how to print the "abacad" out? Thanks for any suggestions, Best regards, On Mon, Feb 13, 2012 at 9:48 PM, lina <lina.lastname@gmail.com> wrote: > $mystring3=3D"abacadeusagaka35"; > > if($mystring =3D~ m/(a.+)/g){ Here supposed to be if($mystring3 =3D~ m/(a.)+/) > =A0 =A0 =A0 =A0print $1,"\n"; showed "ad" only @myarray=3D($mystring3 =3D~ m/(a.)+/); print @myarray,"\n"; also showed "a...

match
Using ASA8 PB8.03 I am dev a jpn app where they use MS IME JPN input which can be defined as half width characters or full width characters something like (a s d d or asddfff) How can I force a validation rule to accept only half width katakana? something like; @columnA= halfwidth kana(obviously I need to replace the second part) or maybe using the match(string,textpattern) But what is the text pattern??? Is this App running on Japanese Windows? pbm_thisusuallydoesnothelp:-)) Philip Salgannik "Matt" <NoEmail@yahoo.com> wrote in message news:eVab6k2...

match data based on matching field
--Boundary_(ID_qfkdjg6SLYMMz7hVKeTUoA) Content-type: text/plain; charset=Windows-1252 Content-transfer-encoding: 7BIT I work with library cataloguing records and am trying to accomplish this amazing feat. Trying is no problem, amazing feat is eluding me I need to find all records with the same ISBN number (field 020)save all matching records which will result in more than 1 record with the same ISBN, then somehow magically end up with only 1 record containing all 856 fields. We import these record to the database from various vendors, and some titles are exactly the same resultin...

Finding Matching Users... but NOT for a Matching rule
I'm trying to write a create rule that says, "If a user being added has the same first and last name as an existing user, create the user with a "pendingXXX" CN." Then, admins can manually determine if the user should have been matched to a pre-existing record, or if this is indeed just a case of similar names. (For business reasons too complex to cover, I can't implement this in a matching rule and we have to leave the manual reconciliation in place.) I have a piece of XSLT (see below) that queries the directory to find a count of existing users who have...

pivot sql matched matched to a report
I have a query that is a pivot table.   Not only will the column numbers vary but the name of the columns will change to.  This query will not always produce a result with same number of columns.What i want to do is just produce a report that is a "select * from pivot query" that will support multiple columns for diffrent runs of the query.Is this possible? I think to achieve this you would have to use a matrix instead of a table....

Matching
I need to implement matching functionality -- match an entry to a list of valid values -- using soundex and fuzzy principles, et. al. Is there third party code I can buy that handles this? james pelton j-pelton@nwu.edu northwestern university Soundex is supported by Sybase Adaptive Server. James Pelton wrote: > I need to implement matching functionality -- match an entry to a list > of valid values -- using soundex and fuzzy principles, et. al. Is there > third party code I can buy that handles this? > > james pelton > j-pelton@nwu.edu > northwestern u...

Regular expression substitution matching all possible matches
This is a question about perl regexp usage. I hope it's okay to post it here; it seemed too advanced for the beginners list. It may lead on to a possible feature request for the perl core. I would like to perform match-and-substitute finding all possible matches of a regular expression within a string. By 'all possible matches' I mean all productions from that regular expression, not just the production that perl's regexp engine happened to find first. So given the regexp /\Ax*/ and the string 'xxx', I would expect to see matches '', 'x', &#...

matching
Hi! I have wrote the following code: while (<TEMP>) { if(m/(http:\/\/www.01net.com\/rdn?oid=[0-9].*&rub=[0-9].*)/ ) { print TEMP2 "$1\n" ; } } The matching doesn't work ! want to match for example : http://www.01net.com/rdn?oid=54682&rub=12456 Can anybody help me ? Thanks Franck > -----Original Message----- > From: COLLINEAU Franck FTRD/DMI/TAM > [mailto:franck.collineau@rd.francetelecom.com] > Sent: Tuesday, October 02, 2001 11:08 AM > To: Perl (E-mail) > Subject...

what does this match for?
I saw a Regex: (?i:(j?sessionid|(php)?sessid|(asp|jserv|jw)?session[-_]?(id)?|cf(id|token)|sid)) I especially didn't know what the leading "?i:" means. Please help, thanks! practicalperl@gmail.com wrote: > I saw a Regex: > > (?i:(j?sessionid|(php)?sessid|(asp|jserv|jw)?session[-_]?(id)?|cf(id|token)|sid)) > > > I especially didn't know what the leading "?i:" means. > Please help, thanks! The /i option means that everything inside the parentheses is a case insensitive pattern. John -- Those people who think they ...

matching **
Hi all. Everyone has been so helpful with my other questions, I thought I would put out another one. I'm writing a script that searches through an array of hashes. One of the possible fields in the hash is "Comments" and sometimes the comments have characters such as ? or * in them. Right now, my search line looks like this if ($myhash{$searchVar} =~ /$value/i) { do stuff; } which works fine for regular text, but chokes up if $value is something like ** due to the matching. I know backslashes would help if I knew in advance it would be **, but the user sets t...

Why is this not a match?
Hello All, I am unable to find out why is this not matching: I do have a file where the second line contains: Summary Log (generated: Tue Apr 1 22:02:29 MST 2003) I am processing this file by this script: #!usr/bin/perl -w use strict; use Fcntl qw[:flock]; my $impressions = 0; my $iofile = '/other/scripts/daniel/input/c07_impressions_io.info'; open (IO, $iofile) || die("Could not open file 1!"); while (<IO> ) { chop; (my$FH, my$output, my$file2check, my$month, my$year) = split (/\s+/, $_); open OUT, ">> $output...

Why not match?
--f46d0447f32cb18c2304c066a888 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hello guys, I have a simple code, but it doesn't work and don't know why. Please see it below: Input file: 1.txt which including number and letter "o" in one line. 10o10o10 Wanted output file: 2.txt in which 10 represent 10 dots and o is replaced by letter "x". ..........x..........x..........x The perl code I wrote is below: #!/usr/bin/perl use strict; use warnings; while(<>){ c...

Web resources about - match not matching - perl.beginners

Matching, Essex - Wikipedia, the free encyclopedia
Matching is a village and civil parish in the Epping Forest district of the County of Essex , England . The village of Matching lying on undulating ...

Facebook Video Chat App Rounds Launches Social Matching Algorithm
Facebook video-chat application Rounds rolled out its social matching algorithm today, which allows users to connect with friends of friends ...

SPMD Kenshoo launches Intent-Driven Audiences, matching search ads to Facebook
Kenshoo , a Facebook Strategic Preferred Marketing Developer, announced Wednesday the launch of Intent-Driven Audiences . This new tool matches ...

App Store - Memory Puzzle - Card Matching Game
Read reviews, get customer ratings, see screenshots, and learn more about Memory Puzzle - Card Matching Game on the App Store. Download Memory ...

Facebook Adds Multiple Matching Options for Custom Audiences
Facebook has added real-time matching across multiple data types to its custom audiences ad-targeting tool. The social network said in a Facebook ...

Recycling: Matching high-tech materials science with economics that work
Video by Jennifer Hahn. (video link) BROOKLYN, New York—A conveyor belt is keeping material flying past at speeds that require both concentration ...

Black Friday 2015 price matching: Which stores do it and how does it work?
... products you want at the prices you've seen advertised, as long as you’re willing to do a little research to take advantage of the price matching ...

Urgent Holiday Gift Matching Donation: Biggest 2016 Progressive Bang For Buck
... Rubio offer. One of Blue America's most generous annual contributors over the course of many years is putting $2,000 on the table as a matching ...

LOOK: Steph Curry's family wearing matching footie pajamas on Christmas
The Curry family gets in the holiday spirit with matching footie pajamas.

Bob Beers: Bruins ‘didn’t come close’ to matching Canadiens intensity in Winter Classic
... 32° Main menu Home Celtics Patriots Red Sox Bruins Revolution More WRITERS Watch Shop NECN Bob Beers: Bruins ‘didn’t come close’ to matching ...

Resources last updated: 1/18/2016 11:35:25 PM