Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > or, || not working with next LABEL

Reply
Thread Tools

or, || not working with next LABEL

 
 
usaims
Guest
Posts: n/a
 
      08-09-2007
Newbie question.
My "or" "||" is not working in my little script, it works if I don't
add an 'or' statement.
Any clue, thanks.
#########################
NOT WORKING
#########################
#!/usr/bin/perl -w
use strict;
use vars qw(@mylist);

CAPTURE:
while ( my $current_line = <DATA> ) {
next CAPTURE if ($current_line !~ m/SOAP <(\S+)>/) || ($current_line !
~ m/GET \/Accurin\/(\S+),/);

push(@mylist,"$1\n");
}
print @mylist;


__DATA__
GET /Accurin/HealthCareProviderSearch, from "
GET /Accurin/HealthCareProviderSearch, from "
GET /Accurin/HealthCareProviderSearch, from "
GET /Accurin/HealthCareProviderSearch, from "
SOAP <PersonSearch> from "
SOAP <IDRequest> from "
SOAP <WirelessSearch> from "

###########################
WORKING
###########################
#!/usr/bin/perl -w
use strict;
use vars qw(@mylist);

CAPTURE:
while ( my $current_line = <DATA> ) {
next CAPTURE if $current_line !~ m/SOAP <(\S+)>/;
push(@mylist,"$1\n");
}
print @mylist;

__DATA__
GET /Accurin/HealthCareProviderSearch, from "
GET /Accurin/HealthCareProviderSearch, from "
GET /Accurin/HealthCareProviderSearch, from "
GET /Accurin/HealthCareProviderSearch, from "
SOAP <PersonSearch> from "
SOAP <IDRequest> from "
SOAP <WirelessSearch> from "

 
Reply With Quote
 
 
 
 
Martijn Lievaart
Guest
Posts: n/a
 
      08-10-2007
On Thu, 09 Aug 2007 15:38:31 -0700, usaims wrote:

> Newbie question.
> My "or" "||" is not working in my little script, it works if I don't
> add an 'or' statement.
> Any clue, thanks.


Well it does precisely what you tell it to do.

(a !~ re) || (b !~ re) is equivelent to
not ((a =~ re) and (b =~ re))

Does that make it clearer? You need and and there, not an or.

HTH,
M4
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl 5.00404 - Label not found for "next " , next() function Liora Perl Misc 5 01-12-2007 03:36 AM
How to get/read Hard disk label / drive label Praveen Python 1 11-05-2006 07:48 PM
<label><div></div></label> allowed? Josef K. ASP .Net 3 05-22-2005 02:13 PM
label versus asp:label Question. Thanks. Shapper ASP .Net 2 05-07-2005 05:55 AM
CurrentElement->next = CurrentElement->next->next (UNDEFINED?) Deniz Bahar C Programming 2 03-09-2005 12:45 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57