[30286] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1529 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 10 14:14:24 2008

Date: Sat, 10 May 2008 11:14:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 10 May 2008     Volume: 11 Number: 1529

Today's topics:
        regex problem unresolved <ela@yantai.org>
    Re: regex problem unresolved <ben.usenet@bsb.me.uk>
    Re: regex problem unresolved (Jens Thoms Toerring)
    Re: The Importance of Terminology's Quality <wgumgfy@gmail.com>
    Re: The Importance of Terminology's Quality <lew@lewscanon.com>
    Re: The Importance of Terminology's Quality <grante@visi.com>
    Re: The Importance of Terminology's Quality <spamtrap@dot-app.org>
    Re: Why Larry Wall uses this background color #e0ff00 f <lovecreatesbeauty@gmail.com>
        XML::Simple <imthenachoman@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 11 May 2008 00:24:25 +0800
From: "Ela" <ela@yantai.org>
Subject: regex problem unresolved
Message-Id: <g04i7p$ff4$1@ijustice.itsc.cuhk.edu.hk>

Dear Gurus,

I was suggested by experts to post runnable codes to seek advice. 
Unfortunately, after 4-day trial, I'm unable to break down the large codes 
written by others to a smaller one. And as what xhoster inferred exactly, 
the matching string comes from a data file and therefore cannot be known in 
advance.

It is a cyclic problem that if I had known which line of the perl codes that 
makes regex fail, I might have already solved half of the problem. But I'm 
really saying the truth that no line number printed. And there's a single 
line of error saying "Invalid [] range "l-c" in regex; marked by <-- HERE in 
m/^3-oxoacyl-[acyl-c
<-- HERE arrier protein] reductase fabg1$/"

Xho suggested 2 solutions. One is index instead of regex that I still don't 
know what it means. Another one is to upgrade perl, which is impossible.

In fact, since input data file is needed and "oxoacyl" does exist in that 
data file confirmed by search, I believe the fetch program first grabs all 
the keywords and later uses the variable one by one to match.

I appreciate your comments/critics what can be done to maximize the chance 
to solve this problem.

Sincerely, Ela !_! 




------------------------------

Date: Sat, 10 May 2008 17:56:00 +0100
From: Ben Bacarisse <ben.usenet@bsb.me.uk>
Subject: Re: regex problem unresolved
Message-Id: <87hcd6cd3z.fsf@bsb.me.uk>

"Ela" <ela@yantai.org> writes:

[I have not followed the previous thread so this may be a big
mistake.  I hope your explanation here stands on its own.]

> I was suggested by experts to post runnable codes to seek advice. 

That is the best way, but...

> Unfortunately, after 4-day trial, I'm unable to break down the large codes 
> written by others to a smaller one.

OK.

> And as what xhoster inferred exactly, 
> the matching string comes from a data file and therefore cannot be known in 
> advance.
>
> It is a cyclic problem that if I had known which line of the perl codes that 
> makes regex fail, I might have already solved half of the problem. But I'm 
> really saying the truth that no line number printed. And there's a single 
> line of error saying "Invalid [] range "l-c" in regex; marked by <-- HERE in 
> m/^3-oxoacyl-[acyl-c
> <-- HERE arrier protein] reductase fabg1$/"

First, do you understand the error message?  A regexp can include [a-b] to
match a range of characters, but the character b must be "bigger than"
a.  Obviously c comes before l so the regexp is invalid.  So far so good.

> Xho suggested 2 solutions. One is index instead of regex that I still don't 
> know what it means. Another one is to upgrade perl, which is
> impossible.
>
> In fact, since input data file is needed and "oxoacyl" does exist in that 
> data file confirmed by search, I believe the fetch program first grabs all 
> the keywords and later uses the variable one by one to match.

Does the code contain [l-c] in a regexp or does the program generate
these REs at run time from some other data?  If the former, you need
to correct it, because it makes no sense (like writing 42/0).  If the
latter, you problem is not to do with the regexp itself but the code
the builds it.  The problem could then be absolutely anywhere and no
one here will be able to help without seeing some more code.

At a wild guess, your program just needs to quote [s in the strings it
reads before turning them into regexps...

-- 
Ben.


------------------------------

Date: 10 May 2008 16:58:56 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: regex problem unresolved
Message-Id: <68m2igF2u4l8uU1@mid.uni-berlin.de>

Ela <ela@yantai.org> wrote:
> I was suggested by experts to post runnable codes to seek advice. 
> Unfortunately, after 4-day trial, I'm unable to break down the large codes 
> written by others to a smaller one. And as what xhoster inferred exactly, 
> the matching string comes from a data file and therefore cannot be known in 
> advance.

> It is a cyclic problem that if I had known which line of the perl codes that 
> makes regex fail, I might have already solved half of the problem. But I'm 
> really saying the truth that no line number printed. And there's a single 
> line of error saying "Invalid [] range "l-c" in regex; marked by <-- HERE in 
> m/^3-oxoacyl-[acyl-c
> <-- HERE arrier protein] reductase fabg1$/"

> Xho suggested 2 solutions. One is index instead of regex that I still don't 
> know what it means. Another one is to upgrade perl, which is impossible.

> In fact, since input data file is needed and "oxoacyl" does exist in that 
> data file confirmed by search, I believe the fetch program first grabs all 
> the keywords and later uses the variable one by one to match.

Unfortunately, your problem descripton is still rather vague
which makes it difficult to come up with an answer. So let
 me start with a summary of what I think I understood you're
trying to do:

You have a file 1 from which you read a string, lets call it
$to_match. That string you somehow have to use to find another
string within a file 2, lets call it $string_to_test.

Something from what you write above makes it look as if you
are only interested in exact matches, i.e. when $match_string
is identical to $string_to_test (the use of '^' and '$' in
the regular expression make it look a bit like that). In that
case the simplest comparison would be a plain

   if ( $match_string eq $string_to_test ) ...

If, on the other hand you want to find $match_string anywhere
within $string_to_test then, as Xho pointed out, the index()
function probably is the best choice, see

    perldoc -f index

since that will get rid of all the problems involved with
using a regex.

If you insist on using a regex then you will have to escape
all characters in $match_string that would be interpreted
by the regular expression matching system like e.g. the '-',
'[', ']' etc. before you use it in the regex.

But if, finally, the file 1 already contains strings meant to
be regular expressions than it looks as i this file simply
contains flawed regex strings and there's hardly anything
you can do to solve the problem (unless you know exactly
which flaws are to be expected and can correct them before
you use $match_string in a regular expression).

                              Regards, Jens
-- 
  \   Jens Thoms Toerring  ___      jt@toerring.de
   \__________________________      http://toerring.de


------------------------------

Date: Sat, 10 May 2008 00:56:33 -0700
From: "Waylen Gumbal" <wgumgfy@gmail.com>
Subject: Re: The Importance of Terminology's Quality
Message-Id: <68l2piF2sv620U1@mid.individual.net>

George Neuner wrote:
> On Thu, 8 May 2008 22:38:44 -0700, "Waylen Gumbal" <wgumgfy@gmail.com>
> wrote:



> > Not everyone follows language-neutral groups (such as
> > comp,programming as you pointed out), so you actually reach more
> > people by cross posting. This is what I don't understand - everyone
> > seems to assume that by cross posting, one intends on start a
> > "flamefest", when in fact most such "flamefests" are started by
> > those who cannot bring themselves to skipping over the topic that
> > they so dislike.
>
> The problem is that many initial posts have topics that are misleading
> or simplistic.  Often an interesting discussion can start on some
> point the initial poster never considered or meant to raise.

Is this not a possibility for any topic, whether it's cross-posted or 
not?


-- 
wg 




------------------------------

Date: Sat, 10 May 2008 08:26:55 -0400
From: Lew <lew@lewscanon.com>
Subject: Re: The Importance of Terminology's Quality
Message-Id: <IfSdnTVIiu0SCbjVnZ2dnUVZ_qrinZ2d@comcast.com>

Waylen Gumbal wrote:
> George Neuner wrote:
>> On Thu, 8 May 2008 22:38:44 -0700, "Waylen Gumbal" <wgumgfy@gmail.com>
>> wrote:
> 
> 
> 
>>> Not everyone follows language-neutral groups (such as
>>> comp,programming as you pointed out), so you actually reach more
>>> people by cross posting. This is what I don't understand - everyone
>>> seems to assume that by cross posting, one intends on start a
>>> "flamefest", when in fact most such "flamefests" are started by
>>> those who cannot bring themselves to skipping over the topic that
>>> they so dislike.
>> The problem is that many initial posts have topics that are misleading
>> or simplistic.  Often an interesting discussion can start on some
>> point the initial poster never considered or meant to raise.
> 
> Is this not a possibility for any topic, whether it's cross-posted or 
> not?

You guys are off topic.  None of the million groups to which this message was 
posted are about netiquette.

-- 
Lew


------------------------------

Date: Sat, 10 May 2008 08:33:14 -0500
From: Grant Edwards <grante@visi.com>
Subject: Re: The Importance of Terminology's Quality
Message-Id: <ZIOdnW5aPMiHObjVnZ2dnUVZ_qDinZ2d@posted.visi>

On 2008-05-10, Lew <lew@lewscanon.com> wrote:

> You guys are off topic.  None of the million groups to which
> this message was posted are about netiquette.

Bah, don't be silly.

All Usenet groups are about netiquette. and Kibo.

-- 
Grant Edwards                   grante             Yow!  I hope I
                                  at               bought the right
                               visi.com            relish... zzzzzzzzz...


------------------------------

Date: Sat, 10 May 2008 12:26:45 -0400
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: The Importance of Terminology's Quality
Message-Id: <m1k5i2rupm.fsf@dot-app.org>

Lew <lew@lewscanon.com> writes:

> You guys are off topic.  None of the million groups to which this
> message was posted are about netiquette.

Netiquette has come up at one point or another in pretty much every
group I've ever read. It's pretty much a universal meta-topic.

sherm--

-- 
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


------------------------------

Date: Sat, 10 May 2008 03:41:48 -0700 (PDT)
From: "lovecreatesbea...@gmail.com" <lovecreatesbeauty@gmail.com>
Subject: Re: Why Larry Wall uses this background color #e0ff00 for his web  page
Message-Id: <cd5843d2-0eec-4ce1-967c-cc09625206bf@y22g2000prd.googlegroups.com>

On May 9, 11:56=A0pm, Andreas P=FCrzer <p...@gmx.net> wrote:
> lovecreatesbea...@gmail.com schrieb:
> >http://www.wall.org/~larry/perl.html,
> > just curious, but this is odd, and does harm the eyes : 0, what do u
> > think?
>
> Onhttp://www.wall.org/~larry/he explains it, right beside his pictures
> (and in the 'Web and CGI' part). What else is there to say? ;)

The background color of the web page in the latter link is #e8ff00.
They are similar but different.


------------------------------

Date: Sat, 10 May 2008 09:04:53 -0700 (PDT)
From: imthenachoman <imthenachoman@gmail.com>
Subject: XML::Simple
Message-Id: <a20d03d0-8819-43a0-af56-ae2045939a7a@b1g2000hsg.googlegroups.com>

I am having some problems with XML::Simple and forcearray. I am trying
to get the XML file read in as an array instead of into a hash. I am
on Perl 5.6.1 and XML::Simple 1.06 and I can not updated. I have to
figure out how to do this on the system I am on.

####################################################################################
XML File:
<?xml version='1.0'?>
<apps>
	<app name="a" id="a">
	</app>
	<app name="b" id="b">
	</app>
</apps>

####################################################################################
Perl Script:
my $xml = new XML::Simple();
my $data = $xml->XMLin(undef, forcearray => ['blah', 'apps','app',
'name', 'id'] );

print( Dumper($data) );

####################################################################################
Output:
$VAR1 = {
          'app' => {
                     'a' => {
                              'id' => 'a'
                            },
                     'b' => {
                              'id' => 'b'
                            }
                   }
        }

####################################################################################
Desired Output:
$VAR1 = {
          'app' => [
                     {
                        name => 'a',
                        id => 'a'
                     },
                     {
                        name => 'b',
                        id => 'b'
                     }
                   ]
        }


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 1529
***************************************


home help back first fref pref prev next nref lref last post