[28310] in Perl-Users-Digest
Perl-Users Digest, Issue: 9674 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 1 21:05:43 2006
Date: Fri, 1 Sep 2006 18:05:06 -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 Fri, 1 Sep 2006 Volume: 10 Number: 9674
Today's topics:
Can anyone explain this code? <mfarid1@yahoo.com>
Re: Can anyone explain this code? usenet@DavidFilmer.com
Re: Can anyone explain this code? <mfarid1@yahoo.com>
Re: Can anyone explain this code? <bik.mido@tiscalinet.it>
Re: Can anyone explain this code? <syscjm@gwu.edu>
Re: Can anyone explain this code? usenet@DavidFilmer.com
Re: Can anyone explain this code? <mfarid1@yahoo.com>
Re: Can anyone explain this code? <mfarid1@yahoo.com>
Can I monitor the execution of a perl script linq936@hotmail.com
Re: Can I monitor the execution of a perl script <David.Squire@no.spam.from.here.au>
Re: Can I monitor the execution of a perl script <glex_no-spam@qwest-spam-no.invalid>
Creating a subset of a hash? usenet@DavidFilmer.com
Re: Creating a subset of a hash? axel@white-eagle.invalid.uk
Re: Creating a subset of a hash? <mritty@gmail.com>
Re: Creating a subset of a hash? usenet@DavidFilmer.com
Re: Creating a subset of a hash? <rvtol+news@isolution.nl>
Re: Creating a subset of a hash? usenet@DavidFilmer.com
Re: Help diagnosing why my program isn't trapping SIGTE <news@lawshouse.org>
Help with 4 dimensional implementation <pradeep.bg@gmail.com>
Re: Help with 4 dimensional implementation <someone@example.com>
Re: Help with 4 dimensional implementation <jgibson@mail.arc.nasa.gov>
Re: Help with 4 dimensional implementation <David.Squire@no.spam.from.here.au>
Re: matching word, but not beetween... <maciekkus@gmail.com>
Re: Net::SMTP problem <usenet05@drabble.me.uk>
ORM modules for Perl <sigzero@gmail.com>
Re: qr// doesn't handle m modifier? <bik.mido@tiscalinet.it>
Re: qr// doesn't handle m modifier? xhoster@gmail.com
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 Sep 2006 12:54:37 -0700
From: "PerlNovice" <mfarid1@yahoo.com>
Subject: Can anyone explain this code?
Message-Id: <1157140477.724824.305070@i42g2000cwa.googlegroups.com>
I would really appreciate it if someone could explain this code?
perl -ne 'open F,">".(join"_",@F).".log" or die "@F $!" if
@F=/(\d+)\s+(\w+)\s+(\d+)\s+(\d\d):(\d\d):(\d\d).*MATCHED/; $m{$2}=$1
if /(\d+)\s+(?=(.))(MATCHED|DUPLICATE|RESIDUAL)/; END{printf F "MATCHED
DUPLICATE RESIDUAL\n%-7d %-9d %-7d\n",@m{qw(M D R)}}' INPUTFILE
I understand parts of it but not all. I can't find help on what the -ne
stands for. Any pointers to where I can go on the internet to find
meaning of this would be appreciated.
------------------------------
Date: 1 Sep 2006 12:56:34 -0700
From: usenet@DavidFilmer.com
Subject: Re: Can anyone explain this code?
Message-Id: <1157140594.833446.155790@i3g2000cwc.googlegroups.com>
PerlNovice wrote:
> I understand parts of it but not all. I can't find help on what the -ne
> stands for. Any pointers to where I can go on the internet to find
> meaning of this would be appreciated.
You don't need the internet:
perldoc perlrun
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 1 Sep 2006 14:15:08 -0700
From: "PerlNovice" <mfarid1@yahoo.com>
Subject: Re: Can anyone explain this code?
Message-Id: <1157145308.895246.298010@i3g2000cwc.googlegroups.com>
usenet@DavidFilmer.com wrote:
> PerlNovice wrote:
> > I understand parts of it but not all. I can't find help on what the -ne
> > stands for. Any pointers to where I can go on the internet to find
> > meaning of this would be appreciated.
>
> You don't need the internet:
>
> perldoc perlrun
>
> --
> David Filmer (http://DavidFilmer.com)
This just gives me explanation of perl -ne
and nothing else.
------------------------------
Date: 1 Sep 2006 23:17:03 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Can anyone explain this code?
Message-Id: <tp8hf2ltbj4in9c9icn8svn2364706uqq7@4ax.com>
On 1 Sep 2006 12:54:37 -0700, "PerlNovice" <mfarid1@yahoo.com> wrote:
>I understand parts of it but not all. I can't find help on what the -ne
>stands for. Any pointers to where I can go on the internet to find
perldoc perlrun (on your own system!)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 01 Sep 2006 17:18:28 -0400
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: Can anyone explain this code?
Message-Id: <12fh8t59flepk3b@corp.supernews.com>
PerlNovice wrote:
> usenet@DavidFilmer.com wrote:
>
>>PerlNovice wrote:
>>
>>>I understand parts of it but not all. I can't find help on what the -ne
>>>stands for. Any pointers to where I can go on the internet to find
>>>meaning of this would be appreciated.
>>
>>You don't need the internet:
>>
>> perldoc perlrun
>>
>>--
>>David Filmer (http://DavidFilmer.com)
>
>
> This just gives me explanation of perl -ne
> and nothing else.
>
perl -ne was all you asked for help on. What else
is puzzling you?
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: 1 Sep 2006 14:27:05 -0700
From: usenet@DavidFilmer.com
Subject: Re: Can anyone explain this code?
Message-Id: <1157146025.490097.43860@m73g2000cwd.googlegroups.com>
PerlNovice wrote:
> This just gives me explanation of perl -ne
> and nothing else.
Well, that's the only thing that you specifically asked about.
You indicated that you already understood other parts of it, so it
doesn't seem necessary to walk through the code and explain it
statement-by-statement. Since I'm not a mind-reader (like Tad), I
don't know which other statements are causing you confusion.
Of course, looking at the code all crammed together like that is bound
to add to anyone's confusion (except maybe Abigail). You might want to
run it through perltidy before trying to mentally parse it:
open F, ">" . ( join "_", @F ) . ".log"
or die "@F $!"
if @F = /(\d+)\s+(\w+)\s+(\d+)\s+(\d\d):(\d\d):(\d\d).*MATCHED/;
$m{$2} = $1
if /(\d+)\s+(?=(.))(MATCHED|DUPLICATE|RESIDUAL)/;
END {
printf F "MATCHED
DUPLICATE RESIDUAL\n%-7d %-9d %-7d\n", @m{qw(M D R)};
}
Ah, that's better. That makes it easier to parse and easier to ask for
clarification about some particular aspect of the code.
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 1 Sep 2006 15:09:53 -0700
From: "PerlNovice" <mfarid1@yahoo.com>
Subject: Re: Can anyone explain this code?
Message-Id: <1157148593.658611.302070@m73g2000cwd.googlegroups.com>
Thank you David, Chris and Michele for your responses. This is what I
understand and this is what I don't understand.
Please correct me if I am wrong:
-n : Loop around the code after the space for as many file names as has
been provided. In my example, just 1.
-e: This is telling the compiler that a one line script is being
entered at the command line.
': Beginning of the code to be executed
open F,: Open a file with file handle F followed by separator between 2
arguments of filename
Of the rest, I only understand bits. for example,
@F: An arrary named F. This is defined later.
printf F "MATCHED DUPLICATE RESIDUAL\n%-7d %-9d %-7d\n": Printing a
line to the newly created file sandwiched between 2 newline characters
; : I know they are end of line characters
or die: If the file is not found then send a file not found message to
stdout
Here are the pieces I don't understand:
1),">".(join"_",@F).".log" or die "@F $!"
2)if @F=/(\d+)\s+(\w+)\s+(\d+)\s+(\d\d):(\d\d):(\d\d).*MATCHED/
3)$m{$2}=$1 if /(\d+)\s+(?=(.))(MATCHED|DUPLICATE|RESIDUAL)/
4)@m{qw(M D R)}}
I would appreciate any explanations and any comments from anyone.
Thanks.
------------------------------
Date: 1 Sep 2006 15:26:03 -0700
From: "PerlNovice" <mfarid1@yahoo.com>
Subject: Re: Can anyone explain this code?
Message-Id: <1157149563.192127.77770@b28g2000cwb.googlegroups.com>
One more thing. I want to put this in a file called MyProc.sh and
execute like this:
perl -ne MyProc.sh
What do I need to do that?
Thanks.
------------------------------
Date: 1 Sep 2006 14:50:26 -0700
From: linq936@hotmail.com
Subject: Can I monitor the execution of a perl script
Message-Id: <1157147426.752164.168350@h48g2000cwc.googlegroups.com>
Hi,
I have a Perl script which starts with #! /bin/perl_5.8.0/bin/perl.
Now I does not run as I expected, I wonder if there is any simple way
to monitor the execution of the script just like I can run "set -xv" in
BASH and see BASH script running?
Thanks.
------------------------------
Date: Fri, 01 Sep 2006 22:51:54 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: Can I monitor the execution of a perl script
Message-Id: <edaa1r$i98$1@gemini.csx.cam.ac.uk>
linq936@hotmail.com wrote:
> Hi,
> I have a Perl script which starts with #! /bin/perl_5.8.0/bin/perl.
>
> Now I does not run as I expected, I wonder if there is any simple way
> to monitor the execution of the script just like I can run "set -xv" in
> BASH and see BASH script running?
>
You can step through it, inspect variables, etc. with the perl debugger.
Type "perl -d myscript.pl"
DS
------------------------------
Date: Fri, 01 Sep 2006 17:12:33 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Can I monitor the execution of a perl script
Message-Id: <44f8af44$0$34079$815e3792@news.qwest.net>
David Squire wrote:
> linq936@hotmail.com wrote:
>> Hi,
>> I have a Perl script which starts with #! /bin/perl_5.8.0/bin/perl.
>>
>> Now I does not run as I expected, I wonder if there is any simple way
>> to monitor the execution of the script just like I can run "set -xv" in
>> BASH and see BASH script running?
>>
>
> You can step through it, inspect variables, etc. with the perl debugger.
> Type "perl -d myscript.pl"
Here's a helpful article on using the debugger.
http://www.perl.com/pub/a/2006/04/06/debugger.html
------------------------------
Date: 1 Sep 2006 11:14:57 -0700
From: usenet@DavidFilmer.com
Subject: Creating a subset of a hash?
Message-Id: <1157134497.696370.210200@h48g2000cwc.googlegroups.com>
I can create an array slice of another array, such as:
my @numbers = qw { 1 2 3 4 };
my @odds = @numbers[0,2];
But, suppose I have a hash like this:
my %number = (
'1' => 'one',
'2' => 'two',
'3' => 'three',
'4' => 'four',
);
And I want to create a subset of it (I don't want to use the term
'slice' here because in hash context it usually means just the values -
I want the keys/values).
I can do something like this:
my %odd;
@odd{1,3} = @number{1,3};
but I type the key list twice (or I must create an array to hold the
keys, and then type the name of the array twice). Anytime I see
something twice I wonder if it can be done differently... but I don't
see a way to avoid it here. Am I wrong?
I suppose I could do something really ugly like:
$odd{$_} = $number{$_} for (1, 3);
but I think I would rather see the list repetition than the loop. I
guess I'm just being pickey, but neither approach makes me want to
frame the code and put it on my wall.
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Fri, 01 Sep 2006 19:19:44 GMT
From: axel@white-eagle.invalid.uk
Subject: Re: Creating a subset of a hash?
Message-Id: <kJ%Jg.9139$cw.1522@fed1read03>
usenet@davidfilmer.com wrote:
> But, suppose I have a hash like this:
> my %number = (
> '1' => 'one',
> '2' => 'two',
> '3' => 'three',
> '4' => 'four',
> );
> And I want to create a subset of it (I don't want to use the term
> 'slice' here because in hash context it usually means just the values -
> I want the keys/values).
> I can do something like this:
> my %odd;
> @odd{1,3} = @number{1,3};
> but I type the key list twice (or I must create an array to hold the
> keys, and then type the name of the array twice). Anytime I see
> something twice I wonder if it can be done differently... but I don't
> see a way to avoid it here. Am I wrong?
You could assign the key list to an array...
my @klist = qw/1 3/;
my %odd;
@odd{@klist} = @number{@klist};
Axel
------------------------------
Date: 1 Sep 2006 12:41:58 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Creating a subset of a hash?
Message-Id: <1157139718.099056.280280@p79g2000cwp.googlegroups.com>
usenet@DavidFilmer.com wrote:
> I can create an array slice of another array, such as:
>
> my @numbers = qw { 1 2 3 4 };
> my @odds = @numbers[0,2];
>
> But, suppose I have a hash like this:
>
> my %number = (
> '1' => 'one',
> '2' => 'two',
> '3' => 'three',
> '4' => 'four',
> );
>
> And I want to create a subset of it (I don't want to use the term
> 'slice' here because in hash context it usually means just the values -
> I want the keys/values).
>
> I can do something like this:
>
> my %odd;
> @odd{1,3} = @number{1,3};
>
> but I type the key list twice (or I must create an array to hold the
> keys, and then type the name of the array twice). Anytime I see
> something twice I wonder if it can be done differently... but I don't
> see a way to avoid it here.
Heh. David seems to be having a brain-cramp today. ;-)
my %odd = map { $_ => $number{$_} } 1, 3;
Paul Lalli
------------------------------
Date: 1 Sep 2006 12:55:15 -0700
From: usenet@DavidFilmer.com
Subject: Re: Creating a subset of a hash?
Message-Id: <1157140515.534153.148250@i3g2000cwc.googlegroups.com>
Paul Lalli wrote:
> Heh. David seems to be having a brain-cramp today. ;-)
Of course - why should today be any different than any other day?
> my %odd = map { $_ => $number{$_} } 1, 3;
D'oh. I keep thinking of map in plain array context and forget how
useful it can be with hashes. Thanks!
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Fri, 1 Sep 2006 22:28:54 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Creating a subset of a hash?
Message-Id: <edacbu.1co.1@news.isolution.nl>
usenet@DavidFilmer.com schreef:
> I suppose I could do something really ugly like:
>
> $odd{$_} = $number{$_} for (1, 3);
What is ugly about that?
$odd{$_} = $number{$_} for qw/1 3/ ;
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 1 Sep 2006 14:16:36 -0700
From: usenet@DavidFilmer.com
Subject: Re: Creating a subset of a hash?
Message-Id: <1157145396.458636.310170@h48g2000cwc.googlegroups.com>
Dr.Ruud wrote:
> What is ugly about that?
>
> $odd{$_} = $number{$_} for qw/1 3/ ;
I guess it's because my mental parser hits the line multiple times.
map() is probably doing the same type of thing under the covers, but my
mind-parser only hits map() once.
Like I said, I'm probably just being too picky.... but I learn stuff
when I ask about alternate approaches.
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Fri, 01 Sep 2006 20:55:14 +0100
From: Henry Law <news@lawshouse.org>
Subject: Re: Help diagnosing why my program isn't trapping SIGTERM on shutdown
Message-Id: <1157140511.19577.1@proxy01.news.clara.net>
xhoster@gmail.com wrote:
> Henry Law <news@lawshouse.org> wrote:
>> I have a program which runs in the background, doing its thing. When it
>> receives a SIGTERM it will tidy up and then exit.
>> But when I restart Linux (Fedora Core 4, using 'shutdown -r now') the
>> code that traps SIGTERM isn't executed
> What happens if you send warnings into your own file, rather than using
> syslogd?
What a good question. I'll experiment. Mean time I threw myself on the
mercies of a C group and an obliging chap there gave me a skeleton of a
C program that does the same thing. As Paul suggested, knowing how it
behaves is key.
--
Henry Law <>< Manchester, England
------------------------------
Date: 1 Sep 2006 16:49:19 -0700
From: "Deepu" <pradeep.bg@gmail.com>
Subject: Help with 4 dimensional implementation
Message-Id: <1157154556.650432.185130@b28g2000cwb.googlegroups.com>
Hi All,
I have a file which has transitions like:
SA
SB
SC
SD
SE
SF
SC
SD
SE
SA
SB
SC
SD
and so on
I am trying to count number of times the transitions occurs (for
example):
SA -> SB -> SC -> SD = 2
SB -> SC -> SD -> SE = 1
SC -> SD -> SE -> SF = 1
SD -> SE -> SF -> SC = 1
SE -> SF -> SC -> SD = 1
SF -> SC -> SD -> SE = 1
SC -> SD -> SE -> SA = 1
SD -> SE -> SA -> SB = 1
SE -> SA -> SB -> SC = 1
SB -> SC -> SD -> and so on
Can somebody please provide me with some ideas.
Thanks
Deep
------------------------------
Date: Sat, 02 Sep 2006 00:29:32 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Help with 4 dimensional implementation
Message-Id: <Mf4Kg.1123$Mh7.793@edtnps90>
Deepu wrote:
>
> I have a file which has transitions like:
>
> SA
> SB
> SC
> SD
> SE
> SF
> SC
> SD
> SE
> SA
> SB
> SC
> SD
> and so on
>
> I am trying to count number of times the transitions occurs (for
> example):
>
> SA -> SB -> SC -> SD = 2
> SB -> SC -> SD -> SE = 1
> SC -> SD -> SE -> SF = 1
> SD -> SE -> SF -> SC = 1
> SE -> SF -> SC -> SD = 1
> SF -> SC -> SD -> SE = 1
> SC -> SD -> SE -> SA = 1
> SD -> SE -> SA -> SB = 1
> SE -> SA -> SB -> SC = 1
> SB -> SC -> SD -> and so on
>
> Can somebody please provide me with some ideas.
$ echo "SA
SB
SC
SD
SE
SF
SC
SD
SE
SA
SB
SC
SD" | perl -lne'
push @x, $_;
@x == 4 && ++$x{ join $;, @x } && shift @x
}{
print join( " -> ", split $; ), " = $x{ $_ }" for sort keys %x
'
SA -> SB -> SC -> SD = 2
SB -> SC -> SD -> SE = 1
SC -> SD -> SE -> SA = 1
SC -> SD -> SE -> SF = 1
SD -> SE -> SA -> SB = 1
SD -> SE -> SF -> SC = 1
SE -> SA -> SB -> SC = 1
SE -> SF -> SC -> SD = 1
SF -> SC -> SD -> SE = 1
John
--
use Perl;
program
fulfillment
------------------------------
Date: Fri, 01 Sep 2006 17:38:49 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Help with 4 dimensional implementation
Message-Id: <010920061738491494%jgibson@mail.arc.nasa.gov>
In article <1157154556.650432.185130@b28g2000cwb.googlegroups.com>,
Deepu <pradeep.bg@gmail.com> wrote:
> Hi All,
>
> I have a file which has transitions like:
What is a "transition"? Are we supposed to know that?
>
> SA
> SB
> SC
> SD
> SE
> SF
> SC
> SD
> SE
> SA
> SB
> SC
> SD
> and so on
>
> I am trying to count number of times the transitions occurs (for
> example):
>
> SA -> SB -> SC -> SD = 2
> SB -> SC -> SD -> SE = 1
> SC -> SD -> SE -> SF = 1
> SD -> SE -> SF -> SC = 1
> SE -> SF -> SC -> SD = 1
> SF -> SC -> SD -> SE = 1
> SC -> SD -> SE -> SA = 1
> SD -> SE -> SA -> SB = 1
> SE -> SA -> SB -> SC = 1
> SB -> SC -> SD -> and so on
Do you mean that a "transition" is four successive strings?
>
> Can somebody please provide me with some ideas.
1. Open the file (perldoc -f open)
2. Read the first four lines into an array (@lines); chomp the strings.
3. Form a hash key from the strings: my $key = "@lines";
4. Increment a %count hash using this key: $count{$key}++;
5. Discard the first element of the array (perldoc -f shift)
6. Read the next line from the file into the last element of the array
(perdoc -f push)
7. If there isn't another line, you are done, go to 8.
Otherwise, go back to 3.
8. Close the file
9. Print out the hash keys and values.
Good luck!
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Sat, 02 Sep 2006 02:00:57 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: Help with 4 dimensional implementation
Message-Id: <edal49$b36$1@gemini.csx.cam.ac.uk>
Deepu wrote:
> Hi All,
>
> I have a file which has transitions like:
I guess we are supposed to read your mind to understand what
"transitions" are...
>
> SA
> SB
> SC
> SD
> SE
> SF
> SC
> SD
> SE
> SA
> SB
> SC
> SD
> and so on
>
> I am trying to count number of times the transitions occurs (for
> example):
>
> SA -> SB -> SC -> SD = 2
> SB -> SC -> SD -> SE = 1
> SC -> SD -> SE -> SF = 1
> SD -> SE -> SF -> SC = 1
> SE -> SF -> SC -> SD = 1
> SF -> SC -> SD -> SE = 1
> SC -> SD -> SE -> SA = 1
> SD -> SE -> SA -> SB = 1
> SE -> SA -> SB -> SC = 1
> SB -> SC -> SD -> and so on
>
> Can somebody please provide me with some ideas.
Something like this? (Obviously could be improved by refactoring)
----
#!/usr/bin/perl
use strict;
use warnings;
my $Length = 4;
my @Seen;
# Note, assumes that we have at least $Length entries in DATA
for (my $i = 0; $i < $Length; $i++) {
my $Line = <DATA>;
chomp $Line;
push @Seen, $Line;
}
my %Transitions;
my $Key = join ' -> ', @Seen;
$Transitions{$Key}++;
while (my $Line = <DATA>) {
chomp $Line;
shift @Seen;
push @Seen, $Line;
my $Key = join ' -> ', @Seen;
$Transitions{$Key}++;
}
foreach my $Key (sort keys %Transitions) {
print "$Key = $Transitions{$Key}\n";
}
__DATA__
SA
SB
SC
SD
SE
SF
SC
SD
SE
SA
SB
SC
SD
----
Output:
SA -> SB -> SC -> SD = 2
SB -> SC -> SD -> SE = 1
SC -> SD -> SE -> SA = 1
SC -> SD -> SE -> SF = 1
SD -> SE -> SA -> SB = 1
SD -> SE -> SF -> SC = 1
SE -> SA -> SB -> SC = 1
SE -> SF -> SC -> SD = 1
SF -> SC -> SD -> SE = 1
----
DS
------------------------------
Date: 1 Sep 2006 16:01:56 -0700
From: "maciekkus@gmail.com" <maciekkus@gmail.com>
Subject: Re: matching word, but not beetween...
Message-Id: <1157151716.691830.143960@p79g2000cwp.googlegroups.com>
Thanks..
That's what I needed :)
This worked for me:
(?<!<b>)(bold and big)(?!<\/b>)
Regards,
Maciek
Paul Lalli napisal(a):
> maciekkus@gmail.com wrote:
> > How can I use regular expressions to match:
> >
> > "this is <b>bold and big</b> and this is not bold and big"
> >
> > I would like regexp to match "bold and big" sentence but not when
> > inside <b> tag.
> >
> > Any help?
>
> Take a look at
> perldoc perlre
> and search for "lookahead" and "lookbehind"
>
> [untested]
> m#(?<!<b>)bold and big(?!</b>)#;
>
> Paul Lalli
------------------------------
Date: Sat, 02 Sep 2006 00:37:16 +0100
From: Graham Drabble <usenet05@drabble.me.uk>
Subject: Re: Net::SMTP problem
Message-Id: <Xns9832651DE619grahamdrabblelineone@ID-77355.user.dfncis.de>
On 30 Aug 2006 "Matt" <mda@unb.ca> wrote in
news:1156964409.840792.180040@i42g2000cwa.googlegroups.com:
> have a simple few lines of Perl I'm trying to run from a cgi
> program to send some email.
> My code looks like:
> use Net::SMTP;
> my $email="mda\@x.com";
why not
my $email = 'mda@x.com'
Saves escaping the @.
> my $msg="hello tst\n";
> $smtp = Net::SMTP->new('smtp.x.com');# or die "Unable to
> open the connection";
Why comment out the or die()? that will only get called if the
Net::SMTP->new() fails, surely you want some form of error handling
there.
> $smtp->mail('...@yahoo.com');
> $smtp->to($email);
> $smtp->data($msg);
> $smtp->dataend();
That isn't a valid mail message. You need some headers.
> $smtp->quit;
>
>
> When I run the code via command line it works. When I run it via a
> cgi program from a webpage I get when it dies on the SMTP->new
> line: Can't call method "mail" on an undefined value
> Everything I"ve searched for says it is because my script cannot
> contact the smtp server, but that's not the case because when I
> run it via the command line, it works fine.
It probably is that you can't connect to (rather than contact) the
server. Most servers run IP based authorisation, the webserver may
well not have permissions to use it. Find the SMTP server of your
webspace.
--
Graham Drabble
http://www.drabble.me.uk/
------------------------------
Date: 1 Sep 2006 17:24:10 -0700
From: "Robert Hicks" <sigzero@gmail.com>
Subject: ORM modules for Perl
Message-Id: <1157156650.853933.27140@b28g2000cwb.googlegroups.com>
Which one do or would you use and why?
Robert
------------------------------
Date: 1 Sep 2006 23:14:47 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: qr// doesn't handle m modifier?
Message-Id: <kj8hf2l6gocf2v1dkp8sjr5slljv2tind4@4ax.com>
On 1 Sep 2006 10:57:38 -0700, adam@irvine.com wrote:
>The following program doesn't do what I expected. The second and third
>"print" statements print, but the first one doesn't. It looks as
>though when the match operator uses a regular expression constructed
>with qr//, the "m" modified that should have been stored in the regular
>expression is ignored. Did I do something wrong, or is this a bug in
(?imsx-imsx) => check perldoc perlre
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 01 Sep 2006 22:06:21 GMT
From: xhoster@gmail.com
Subject: Re: qr// doesn't handle m modifier?
Message-Id: <20060901180652.348$gt@newsreader.com>
Michele Dondi <bik.mido@tiscalinet.it> wrote:
> On 1 Sep 2006 10:57:38 -0700, adam@irvine.com wrote:
>
> >The following program doesn't do what I expected. The second and third
> >"print" statements print, but the first one doesn't. It looks as
> >though when the match operator uses a regular expression constructed
> >with qr//, the "m" modified that should have been stored in the regular
> >expression is ignored. Did I do something wrong, or is this a bug in
I get the same behavior as you do, using 5.8.8.
>
> (?imsx-imsx) => check perldoc perlre
I don't think his question is where the behavior is described, but
rather why the actual behavior does not seem to match the description that
perlre gives.
I'm rather stumped on that, too.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
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 V10 Issue 9674
***************************************