[28460] in Perl-Users-Digest
Perl-Users Digest, Issue: 9824 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 9 18:06:05 2006
Date: Mon, 9 Oct 2006 15:05:07 -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 Mon, 9 Oct 2006 Volume: 10 Number: 9824
Today's topics:
Re: Data Extraction Hierarchial Report <bradbrockman@yahoo.com>
Re: Data Extraction Hierarchial Report <bradbrockman@yahoo.com>
Re: Data Extraction Hierarchial Report <benmorrow@tiscali.co.uk>
Re: Data Extraction Hierarchial Report <someone@example.com>
Gusetbook with flowers and comment <pegboy_30@yahoo.com>
Re: Gusetbook with flowers and comment usenet@DavidFilmer.com
Re: Gusetbook with flowers and comment <tadmc@augustmail.com>
Re: Hard or Easy? To find string, then grab criterion m samiam@mytrashmail.com
Re: Hard or Easy? To find string, then grab criterion m <sherm@Sherm-Pendleys-Computer.local>
Re: Hard or Easy? To find string, then grab criterion m samiam@mytrashmail.com
Re: Mechanize location <benmorrow@tiscali.co.uk>
Perl ActiveX: A VBA string passed to my control is trea david.f.jenkins@usa.net
Re: Perl ActiveX: A VBA string passed to my control is david.f.jenkins@usa.net
Re: Perl ActiveX: A VBA string passed to my control is david.f.jenkins@usa.net
Perl Split on a Long Sentence Question <bwilkins@gmail.com>
Re: Perl Split on a Long Sentence Question usenet@DavidFilmer.com
Re: Perl Split on a Long Sentence Question anno4000@radom.zrz.tu-berlin.de
Re: Perl Split on a Long Sentence Question (reading news)
Re: Perl Split on a Long Sentence Question <bwilkins@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 Oct 2006 10:29:13 -0700
From: "banker123" <bradbrockman@yahoo.com>
Subject: Re: Data Extraction Hierarchial Report
Message-Id: <1160414952.923887.297850@i3g2000cwc.googlegroups.com>
See output, this seemd to work except for the last line, any
suggestions?
123456 Johns Account 10.00 Apples 10/08/2006
123456 Johns Account 20.00 Grapes 10/07/2006
987654 Bobs Account 10.00 Oranges 10/08/2006
987654 Bobs Account 20.00 Plums 10/07/2006
987654 Bobs Account 987654 Bobs Account
Tad McClellan wrote:
> banker123 <bradbrockman@yahoo.com> wrote:
>
> > Should be
>
>
> No it shouldn't.
>
> It contains a whole boatload of bad practices.
>
>
> > open(data,'C:\data.txt');
>
>
> You should use UPPERCASE for bareword filehandles. Even better,
> you should use a lexical file handle instead.
>
> The 3-arg form of open() is much much safer.
>
> You should always, yes *always*, check the return value from open().
>
> You can use sensible slashes in paths that are not destined for
> a Windows "shell".
>
>
> > @array=<data>;
>
>
> You should enable strictures in all of your Perl programs. That
> requires that you declare each variable that you use.
>
>
> > foreach $line(@array){
>
>
> There is no need to read the entire file if you are going to
> process it line-by-line anyway.
>
> Just read it line-by-line, then it will continue to work even
> on huge files.
>
>
> > if ($line =~ /Account/){
>
>
> Nothing wrong with that one, but some whitespace would make it
> easier to read and understand.
>
>
> > print "$line";
>
>
> You should never quote a lone scalar variable. See:
>
> perldoc -q vars
>
> What's wrong with always quoting "$vars"?
>
>
>
> So then, we end up with (untested):
>
> use warnings;
> use strict;
>
> open( my $ACCOUNTS, '<', 'C:/data.txt' ) or
> die "could not open the 'C:/data.txt' file $!";
> while ( my $line = <$ACCOUNTS> ) {
> if ( $line =~ /Account/ ) {
> print $line;
> }
> }
> close $ACCOUNTS;
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: 9 Oct 2006 11:23:15 -0700
From: "banker123" <bradbrockman@yahoo.com>
Subject: Re: Data Extraction Hierarchial Report
Message-Id: <1160418195.574503.137430@b28g2000cwb.googlegroups.com>
John, this worked can you explain the expressions used to extract the
data?
John W. Krahn wrote:
> banker123 wrote:
> > The following code will extract the header record, the challeng I am
> > having is appending this to the detail records.
> >
> > open(data,'C:\data.txt');
> > @array=<data>;
> >
> > foreach $line(@array){
> > if ($line =~ /B./){
> > print "$line";
> > }
> > }
>
> You want something like (UNTESTED):
>
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> my $file = 'C:/data.txt';
>
> open my $fh, '<', $file or die "Cannot open $file: $!";
>
> my $account;
> while ( <$fh> ) {
> if ( /\A\d/ ) {
> ( $account = $_ ) =~ s/\s+\z//;
> }
> elsif ( s/\A\s+// ) {
> print "$account $_";
> }
> }
>
> __END__
>
>
>
> John
> --
> Perl isn't a toolbox, but a small machine shop where you can special-order
> certain sorts of tools at low cost and in short order. -- Larry Wall
------------------------------
Date: Mon, 9 Oct 2006 04:12:18 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Data Extraction Hierarchial Report
Message-Id: <i9rov3-nc8.ln1@osiris.mauzo.dyndns.org>
Quoth "banker123" <bradbrockman@yahoo.com>:
> I have the following data in a file.
>
> 123456 Johns Account
> 10.00 Apples 10/08/2006
> 20.00 Grapes 10/07/2006
> 987654 Bobs Account
> 10.00 Oranges 10/08/2006
> 20.00 Plums 10/07/2006
>
> I need to build a file to populate a database like
>
> 123456 Johns Account 10.00 Apples 10/08/2006
> 123456 Johns Account 20.00 Grapes 10/07/2006
> 987654 Bobs Account 10.00 Oranges 10/08/2006
> 987654 Bobs Account 20.00 Plums 10/08/2006
>
> This your classical hierarchial report, the challenge I have had is in
> exeucting the append, defining the header and detail records. Please
> help, this has been eluding me for some time.
What have you tried?
Ben
--
If you put all the prophets, | You'd have so much more reason
Mystics and saints | Than ever was born
In one room together, | Out of all of the conflicts of time.
benmorrow@tiscali.co.uk The Levellers, 'Believers'
------------------------------
Date: Mon, 09 Oct 2006 19:28:29 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Data Extraction Hierarchial Report
Message-Id: <xpxWg.4353$P7.741@edtnps90>
banker123 wrote:
>
> John W. Krahn wrote:
>>
>>You want something like (UNTESTED):
>>
>>#!/usr/bin/perl
>>use warnings;
>>use strict;
>>
>>my $file = 'C:/data.txt';
>>
>>open my $fh, '<', $file or die "Cannot open $file: $!";
>>
>>my $account;
>>while ( <$fh> ) {
>> if ( /\A\d/ ) {
>> ( $account = $_ ) =~ s/\s+\z//;
>> }
>> elsif ( s/\A\s+// ) {
>> print "$account $_";
>> }
>> }
>>
>>__END__
>
> John, this worked can you explain the expressions used to extract the
> data?
Yes I can.
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
------------------------------
Date: Mon, 09 Oct 2006 16:21:17 GMT
From: Coconut <pegboy_30@yahoo.com>
Subject: Gusetbook with flowers and comment
Message-Id: <1atki250qu3oe84v41vduq4jf213l2omfp@4ax.com>
Hi folks, I'd like to get a perl script where I can have people fill
in a small form and choose a flower/image (Its a memorial page), which
is then published on the same page. I guess it would be a guestbook
type of thing, but I can't find any where people can pick their own
flowers/images.
Many thanks for help and/or leads,
Chris
--Chris
Neat stuff for sale - art nouveau to bayonets:
http://www.ckdeco.com
------------------------------
Date: 9 Oct 2006 09:55:55 -0700
From: usenet@DavidFilmer.com
Subject: Re: Gusetbook with flowers and comment
Message-Id: <1160412955.243379.231950@k70g2000cwa.googlegroups.com>
Coconut wrote:
> but I can't find any where people can pick their own flowers
http://proflowers.com
http://ftd.com
--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Mon, 9 Oct 2006 12:40:07 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Gusetbook with flowers and comment
Message-Id: <slrneil2bn.jdp.tadmc@magna.augustmail.com>
Coconut <pegboy_30@yahoo.com> wrote:
> I'd like to get a perl script
Then use a search engine.
If you would like to *write* a perl script, then post here.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 9 Oct 2006 10:53:08 -0700
From: samiam@mytrashmail.com
Subject: Re: Hard or Easy? To find string, then grab criterion matched lines above and below?
Message-Id: <1160416388.549622.317280@b28g2000cwb.googlegroups.com>
Hi Steve,
Very able defense. Thank you.
You are, of course, correct: There is no cgi or Web Server involved in
this equation. I didn't know "cgi was off limits" or taboo in this
group. Why is cgi a no-no?
My application of this perl parser is to report the output of security
related registry changes on voice recognition servers. They are stand
alone w2k boxes being brought into lock-down compliance.
Thanks to someone named Brigmar over on Tek-Tips, I have a very elegant
solution, far more terse than I imagined. In little over 20 lines of
code, he conditionally pulls data from FILE-A and uses this data to
conditionally pull from FILE-B and then posts it all in a CSV file. Do
you think his code is especially economical and clean?
http://home.comcast.net/~tankomail/Brigmar_Report_script.pl
The only thing I have failed at doing is pulling the:
%%before and %% after registry keys and putting these into additional
columns in the CSV file.
I figure with this model, there is a whole world of pasing tasks I
could do with this as my code base.
Do you have a line into how I could add the two additional column
values?
The simple project is summed at the bottom as well as links to the 2
data files, Brigmar's excellent script on which all is based and a few
pasted data samples from the 2 linked data files.
Thanks for your input!
L,
S
-----------------------------------------
DATA FILES AND INITIAL SCRIPT FROM BRIGMAR from Tek Tips.
http://home.comcast.net/~tankomail/test.dsc FILE-A data
http://home.comcast.net/~tankomail/server1.aud FILE-B data
http://home.comcast.net/~tankomail/Brigmar_Report_script.pl Brigmar
Script
http://home.comcast.net/~tankomail/logfile.csv - The CSV files the
script creates
Below is a snippet of FILE-A data which matches FILE-B data.
For instance - the fail line 5.4.6.24 in FILE-B matches the # cached
logon credentials # section in FILE-A vis-a-vis the section
containing the same 5.4.6.24 CSR#.
FILE-A is no more than sections delimited by #Section Title# , the
Registry key that needs to be changed, and identified by CSR numbers.
The goal is to pull the registry entry from each failed CSR section
(Identified in FILE-B) and pull from FILE-A:
1.) #section title#
2.) CSR#
3.) %%before and %% after registry keys
and push this data into CSV format for viewing with Excel.
--------------------------
FILE-B Aud file:
5.7.1.2~Password Expires Requirement~FAIL~FAIL~
5.4.6.62~Force Unlock Logon~FAIL~FAIL~
5.4.6.24~Cached logon credentials~FAIL~FAIL~1010
5.4.6.27~Smart Card Behavior~FAIL~FAIL~11
5.4.6.20~Auto Admin Login Settings~PASS~PASS~00
5.4.6.9~Sharing of Devices - Floppys~PASS~PASS~11
5.4.6.9~Sharing of Devices - CDRoms~PASS~PASS~11
5.4.6.7~Sharing of Devices - DASD~PASS~PASS~00
5.4.6.16~IPSec Security for Kerberos RSVP Traffic~PASS~PASS~11
5.4.6.17~Hide Computer Name~FAIL~FAIL~
---------------------------
Find the fail lines, get the CSR at the beginning of the line and match
to registry change section in FILE-A
-------------------------
FILE-A dsc file:
# cached logon credentials #
dialog set,text1,"5.4.6.24 Cached logon
credentials" **********Wish to add these descriptions to csv
dialog set,text2,"5.4.6.24 Cached logon credentials"
%%before = @REGREAD(HLM,SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon,CachedLogonsCount,)
REGISTRY WRITE,HLM,SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon,CachedLogonsCount,2
%%after = @REGREAD(HLM,SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon,CachedLogonsCount,)
%%stat = FAIL
%%stat2 = FAIL
if @equal(%%before,"2")
%%stat = PASS
end
if @equal(%%after,"2")
%%stat2 = PASS
end
list add,debug,"Cached logon credentials:Setting Before Run" %%before
"Setting After Run:" %%after
list add,log,"5.4.6.24~Cached logon
credentials~"%%stat"~"%%stat2"~"%%before%%after
list savefile,log,%%logfile
list savefile,debug,%%debugfile
wait 0.2
:checktwentyseven
%%check = @INIREAD(checks,checktwentyseven)
if @equal(%%check,off)
goto checktwentyeight
end
---------------------------
Steve K. wrote:
> Tad McClellan wrote:
> >Steve Kostecke <spamtrap@ntp.isc.org> wrote:
> >> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> >> news:slrneib43v.9e3.tadmc@magna.augustmail.com...
> >>> samiam@mytrashmail.com <samiam@mytrashmail.com> wrote:
> >
> >>>> At first I thought to use VBScript, but then I realized that Perl
> >>>> is portable, doesn't necessarily have to be installed on the
> >>>> server, and
> >>>
> >>>
> >>> What "server"?
> >>>
> >>> A server is not normally required to run Perl programs.
> >>>
> >>> Is this a stealth CGI question?
> >>
> >> His question was obviously pertaining to Perl being used for a file
> >> parsing solution. The question itself had nothing to do with CGI and
> >> I think you knew that.
> >
> >
> > Yes, I did.
> >
> > But it appeared that the OP did not. Now he does.
>
> What made you think he did not?? Simply because he said "server" some
> how automagically translates into your min into "web server" ? Has it
> even occurred to you he could of simply meant a remote server he has
> been working on? For instance, you SSH or Remote-Desktop/VNC in and you
> work; not exactly a new concept. This can be for any number of purposes,
> and he never said one thing abut www, web, http, nor cgi.
>
> Lets take a look at what he DID say:
>
> samiam@mytrashmail.com wrote:
> > Hello,
> >
> > I know this is a trivial parse / grep job for any Perl rake worth his
> > salt,
>
> Hmm, "trivial parse / grep job ", looks right up Perl's alley.
>
> > but does anyone have guidance on how this Perl newbie might pull
> > a string from one file and use this string to pull the lines in
> > another file out, and also pull the first line before (matching
> > criteria) and the first line after (matching criteria.)
>
> Text parsing stuff, still very valid for Perl, don'cha think?
>
> > I have described this in detail below.
> >
> > At first I thought to use VBScript,
>
> VBScript has many applications outside of web scripting. He makes no
> mention of web, http, or cgi so no reason to go there. (See "Scripting
> Host" on Windows.)
>
> > but then I realized that Perl is
> > portable, doesn't necessarily have to be installed on the server, and
> > probably has MUCH better string processing power than VBScript.
>
> In this context, he could of either meant a "remove server" or he could
> of been referring to any old box. Still no mention of anything web
> related.
>
> > I also considered grep, but still thought I could reuse the Perl
> > solution in more places.
>
> So please tell me how anything he said can be seen as a CGI question,
> and how it was even remotely fair to accuse him like you did of making a
> "stealth CGI question" when everything he wrote was HOW to do some
> "trivial parse / grep job" with Perl. Even with CGI questions it's often
> been said it will go answered if the question is still _directed_ at the
> Perl side of things, so I really see no point at all as trying to paint
> him as trying to do something wrong with words like "stealth", as if
> you're just simply witch hunting.
------------------------------
Date: Mon, 09 Oct 2006 14:24:22 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: Hard or Easy? To find string, then grab criterion matched lines above and below?
Message-Id: <m2vemtqre1.fsf@Sherm-Pendleys-Computer.local>
samiam@mytrashmail.com writes:
> You are, of course, correct: There is no cgi or Web Server involved in
> this equation. I didn't know "cgi was off limits" or taboo in this
> group. Why is cgi a no-no?
If the answer to your question would be the same if you were writing in
some other language, then it's not a Perl question, and therefore off-
topic here.
A contrived example: "I print some HTML from my Perl CGI. The page renders
fine in FireFox, but not in IE." That's not a Perl question, it's an HTML
question; the answer is "fix the HTML". The fact that the HTML is the
output from a Perl script doesn't make it a Perl question.
Another contrived example: "I'm returning the correct MIME type from my
CGI script, but IE ignores that and parses it as HTML anyway." Once again,
that's not a Perl question, since IE would be doing precisely the same
thing if your CGI were written in Python, Ruby, or whatever.
It isn't just a question of netiquette and/or courtesy either. Understanding
a problem is a critical step in solving it. Quite often, in the process of
narrowing down the exact nature of a bug, in preparation of deciding which
group to ask questions in, I find that I've found the bug myself and don't
need to ask in any group at all.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: 9 Oct 2006 12:56:24 -0700
From: samiam@mytrashmail.com
Subject: Re: Hard or Easy? To find string, then grab criterion matched lines above and below?
Message-Id: <1160423784.329150.26940@k70g2000cwa.googlegroups.com>
Ahhh...of course. Makes sense. Thanks!
Just to be clear, my question is in fact, strictly a Perl parsing
question :)
L,
S
Sherm Pendley wrote:
> samiam@mytrashmail.com writes:
>
> > You are, of course, correct: There is no cgi or Web Server involved in
> > this equation. I didn't know "cgi was off limits" or taboo in this
> > group. Why is cgi a no-no?
>
> If the answer to your question would be the same if you were writing in
> some other language, then it's not a Perl question, and therefore off-
> topic here.
>
> A contrived example: "I print some HTML from my Perl CGI. The page renders
> fine in FireFox, but not in IE." That's not a Perl question, it's an HTML
> question; the answer is "fix the HTML". The fact that the HTML is the
> output from a Perl script doesn't make it a Perl question.
>
> Another contrived example: "I'm returning the correct MIME type from my
> CGI script, but IE ignores that and parses it as HTML anyway." Once again,
> that's not a Perl question, since IE would be doing precisely the same
> thing if your CGI were written in Python, Ruby, or whatever.
>
> It isn't just a question of netiquette and/or courtesy either. Understanding
> a problem is a critical step in solving it. Quite often, in the process of
> narrowing down the exact nature of a bug, in preparation of deciding which
> group to ask questions in, I find that I've found the bug myself and don't
> need to ask in any group at all.
>
> sherm--
>
> --
> Web Hosting by West Virginians, for West Virginians: http://wv-www.net
> Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Mon, 9 Oct 2006 04:11:30 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Mechanize location
Message-Id: <28rov3-nc8.ln1@osiris.mauzo.dyndns.org>
Quoth dysgraphia <ldolan@bigpond.net.au>:
> Hi, Using XP. Brand new to perl. I have downloaded Mechanize
> but am not sure in which folder it should be.
> Any advice appreciated!
You need to download the whole tarball and install it properly,
according to the instructions. Alternatively, you can use CPAN.pm to do
it for you; or, as you are on Win32, use ppm (I would recommedn the
last). The documentation for is included with ActivePerl.
Ben
--
Raise your hand if you're invulnerable.
[benmorrow@tiscali.co.uk]
------------------------------
Date: 9 Oct 2006 13:03:10 -0700
From: david.f.jenkins@usa.net
Subject: Perl ActiveX: A VBA string passed to my control is treated as a doubel-quoted string
Message-Id: <1160424190.285352.270560@e3g2000cwe.googlegroups.com>
Hi: I'm very new at all things Perl, so I may have my terminology
boogered up. Here goes:
I have written a Perl ActiveX control that's suppose to do some regular
expression operations on data and patterns sent from VBA (as VT_BSTR).
Everything seems to be working ok, except that it appears the pattern
arguments to Perl are being treated as double-quoted strings.
Here is a string I'm passing in from VBA (and also using when testing
using a Perl call):
"(\s)(-{1,2}|-)(\s)" (the character after the vertical bar is an en
dash.)
When I use this string in VBA, I get erroneous resutls from my control.
If I write a call in Perl, using the same arguments as I use in VBA, I
also get erroneous results. However, if I change the Perl argument
string to a single-quoted string, then I get correct results. Alos, if
I change the \s's to blanks and use double quotes, it works ok. If I
leave the \s's in and use single-quotes, it works ok. But as is -
unh-unh.
Do I have interpolative context problems? The larger question I have,
is how can I coerce the control to treat the string that's being passed
in as single-quoted string? Or is there perhaps some easier solution?
Thanks.
------------------------------
Date: 9 Oct 2006 14:40:52 -0700
From: david.f.jenkins@usa.net
Subject: Re: Perl ActiveX: A VBA string passed to my control is treated as a doubel-quoted string
Message-Id: <1160430052.294109.187390@m7g2000cwm.googlegroups.com>
david.f.jenkins@usa.net wrote:
> Hi: I'm very new at all things Perl, so I may have my terminology
> boogered up. Here goes:
>
> I have written a Perl ActiveX control that's suppose to do some regular
> expression operations on data and patterns sent from VBA (as VT_BSTR).
> Everything seems to be working ok, except that it appears the pattern
> arguments to Perl are being treated as double-quoted strings.
>
> Here is a string I'm passing in from VBA (and also using when testing
> using a Perl call):
>
> "(\s)(-{1,2}|-)(\s)" (the character after the vertical bar is an en
> dash.)
>
> When I use this string in VBA, I get erroneous resutls from my control.
> If I write a call in Perl, using the same arguments as I use in VBA, I
> also get erroneous results. However, if I change the Perl argument
> string to a single-quoted string, then I get correct results. Alos, if
> I change the \s's to blanks and use double quotes, it works ok. If I
> leave the \s's in and use single-quotes, it works ok. But as is -
> unh-unh.
>
> Do I have interpolative context problems? The larger question I have,
> is how can I coerce the control to treat the string that's being passed
> in as single-quoted string? Or is there perhaps some easier solution?
Well, I have no idea what's going on, but it all seems to be working
now. This is after taking down PowerPoint (the source of the VBA code)
and the ActiveState Perl IDE and birning everything back up again.
Curiouser and curiouser.
------------------------------
Date: 9 Oct 2006 14:46:34 -0700
From: david.f.jenkins@usa.net
Subject: Re: Perl ActiveX: A VBA string passed to my control is treated as a doubel-quoted string
Message-Id: <1160430394.628249.85280@c28g2000cwb.googlegroups.com>
david.f.jenk...@usa.net wrote:
> david.f.jenkins@usa.net wrote:
> > Hi: I'm very new at all things Perl, so I may have my terminology
> > boogered up. Here goes:
> >
> > I have written a Perl ActiveX control that's suppose to do some regular
> > expression operations on data and patterns sent from VBA (as VT_BSTR).
> > Everything seems to be working ok, except that it appears the pattern
> > arguments to Perl are being treated as double-quoted strings.
> >
> > Here is a string I'm passing in from VBA (and also using when testing
> > using a Perl call):
> >
> > "(\s)(-{1,2}|-)(\s)" (the character after the vertical bar is an en
> > dash.)
> >
> > When I use this string in VBA, I get erroneous resutls from my control.
> > If I write a call in Perl, using the same arguments as I use in VBA, I
> > also get erroneous results. However, if I change the Perl argument
> > string to a single-quoted string, then I get correct results. Alos, if
> > I change the \s's to blanks and use double quotes, it works ok. If I
> > leave the \s's in and use single-quotes, it works ok. But as is -
> > unh-unh.
> >
> > Do I have interpolative context problems? The larger question I have,
> > is how can I coerce the control to treat the string that's being passed
> > in as single-quoted string? Or is there perhaps some easier solution?
>
> Well, I have no idea what's going on, but it all seems to be working
> now. This is after taking down PowerPoint (the source of the VBA code)
> and the ActiveState Perl IDE and birning everything back up again.
> Curiouser and curiouser.
Whoops - wrong again. Had my hands crossed and was running a VBScript
version, which runs just fine. Back to the Perl questions, I'm afraid.
------------------------------
Date: 9 Oct 2006 09:37:21 -0700
From: "Brian Wilkins" <bwilkins@gmail.com>
Subject: Perl Split on a Long Sentence Question
Message-Id: <1160411839.327627.54140@i3g2000cwc.googlegroups.com>
I am trying to split a session log into meaningful data for regression
testing. The session log is defined as follows:
[ 1] Memory Leak Exiting Program: Address 0x0F701E90 (128) allocated
by HeapAlloc., Interesting Location: WpjData.dll ! 0x00013279
This information is similarly repeated over several lines for each DLL
that leaked.
The information I want to preserve is
"Memory Leak Exiting Program"
"Address 0x0F701E90"
"128"
"HeapAlloc"
"WpjData.dll ! 0x000013279"
All other information on the line is extraneous. Any clue as to how I
should parse this? I'm trying to find an appropriate pattern.
Thanks.
------------------------------
Date: 9 Oct 2006 09:59:12 -0700
From: usenet@DavidFilmer.com
Subject: Re: Perl Split on a Long Sentence Question
Message-Id: <1160413152.463867.223640@i42g2000cwa.googlegroups.com>
Brian Wilkins wrote:
> All other information on the line is extraneous. Any clue as to how I
> should parse this? I'm trying to find an appropriate pattern.
You probably won't be able to find such a pattern - you will need to
write your own. You may wish to consult:
perldoc perlre
If you have trouble with your efforts, feel free to post your code for
review and comment.
--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 9 Oct 2006 17:01:33 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Perl Split on a Long Sentence Question
Message-Id: <4ovdjdFg44rfU1@news.dfncis.de>
Brian Wilkins <bwilkins@gmail.com> wrote in comp.lang.perl.misc:
> I am trying to split a session log into meaningful data for regression
> testing. The session log is defined as follows:
>
> [ 1] Memory Leak Exiting Program: Address 0x0F701E90 (128) allocated
> by HeapAlloc., Interesting Location: WpjData.dll ! 0x00013279
>
> This information is similarly repeated over several lines for each DLL
> that leaked.
>
> The information I want to preserve is
>
> "Memory Leak Exiting Program"
>
> "Address 0x0F701E90"
>
> "128"
>
> "HeapAlloc"
>
> "WpjData.dll ! 0x000013279"
>
> All other information on the line is extraneous. Any clue as to how I
> should parse this? I'm trying to find an appropriate pattern.
What have you tried?
We help people fix their programs, but we don't deliver according
to specification.
Speaking of which, a single example without a word how the data
varies from case to case is useless as a specification. Far less
is it a definition.
Anno
------------------------------
Date: Mon, 09 Oct 2006 19:43:02 GMT
From: "Mumia W. (reading news)" <paduille.4059.mumia.w@earthlink.net>
Subject: Re: Perl Split on a Long Sentence Question
Message-Id: <aDxWg.5041$Lv3.3314@newsread1.news.pas.earthlink.net>
On 10/09/2006 11:37 AM, Brian Wilkins wrote:
> I am trying to split a session log into meaningful data for regression
> testing. The session log is defined as follows:
>
> [ 1] Memory Leak Exiting Program: Address 0x0F701E90 (128) allocated
> by HeapAlloc., Interesting Location: WpjData.dll ! 0x00013279
>
> This information is similarly repeated over several lines for each DLL
> that leaked.
>
> The information I want to preserve is
>
> "Memory Leak Exiting Program"
>
> "Address 0x0F701E90"
>
> "128"
>
> "HeapAlloc"
>
> "WpjData.dll ! 0x000013279"
>
> All other information on the line is extraneous. Any clue as to how I
> should parse this? I'm trying to find an appropriate pattern.
>
> Thanks.
>
The "split" function would not be very good for this. Can you think of a
regular expression to match and extract the strings that you want from
that record?
In case you haven't read it already, read "perldoc perlretut".
--
Mumia W.
paduille.4059.mumia.w@earthlink.net
This is a temporary e-mail to help me catch some s-p*á/m.
------------------------------
Date: 9 Oct 2006 14:05:09 -0700
From: "Brian Wilkins" <bwilkins@gmail.com>
Subject: Re: Perl Split on a Long Sentence Question
Message-Id: <1160427909.567709.250020@i3g2000cwc.googlegroups.com>
Thanks for the suggestion. With the help of an anonymous
comp.lang.perl.misc reader, he should me how to solve this problem
using regex.
Mumia W. (reading news) wrote:
> On 10/09/2006 11:37 AM, Brian Wilkins wrote:
> > I am trying to split a session log into meaningful data for regression
> > testing. The session log is defined as follows:
> >
> > [ 1] Memory Leak Exiting Program: Address 0x0F701E90 (128) allocated
> > by HeapAlloc., Interesting Location: WpjData.dll ! 0x00013279
> >
> > This information is similarly repeated over several lines for each DLL
> > that leaked.
> >
> > The information I want to preserve is
> >
> > "Memory Leak Exiting Program"
> >
> > "Address 0x0F701E90"
> >
> > "128"
> >
> > "HeapAlloc"
> >
> > "WpjData.dll ! 0x000013279"
> >
> > All other information on the line is extraneous. Any clue as to how I
> > should parse this? I'm trying to find an appropriate pattern.
> >
> > Thanks.
> >
>
> The "split" function would not be very good for this. Can you think of a
> regular expression to match and extract the strings that you want from
> that record?
>
> In case you haven't read it already, read "perldoc perlretut".
>
>
> --
> Mumia W.
> paduille.4059.mumia.w@earthlink.net
> This is a temporary e-mail to help me catch some s-p*=E1/m.
------------------------------
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 9824
***************************************