[27744] in Perl-Users-Digest
Perl-Users Digest, Issue: 9134 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 9 03:05:49 2006
Date: Sun, 9 Apr 2006 00:05:05 -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 Sun, 9 Apr 2006 Volume: 10 Number: 9134
Today's topics:
Extract range of lines from a text file <softouch@softouch.on.ca>
new CPAN modules at Sun Apr 9 2006 (Randal Schwartz)
Re: XS progamming question <nospam-abuse@ilyaz.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 08 Apr 2006 23:20:40 -0400
From: Amer Neely <softouch@softouch.on.ca>
Subject: Extract range of lines from a text file
Message-Id: <e3%Zf.64563$fd.10121@read2.cgocable.net>
This is driving me nuts.
I'm walking through a mailbox file, and want to pull out specific lines
from each message. The body of each message is in a similar format,
having been generated by a script.
I'm doing OK except for one particular block of lines, the customer
address data. There is a blank line before and after this block. Example:
Transaction Time: 18:45:55
Amer Neely
POB 1481 Station Main
North Bay ON
P1B 8K7
CANADA
123-456-7890
I've managed to get the 5 lines into a string using this code:
while <IN>
{
# bunch of other comparisons deleted
if (/^Transaction Time:/ ... /^\d\d\d-\d\d\d-\d\d\d\d$/)
{
$CustData = $_;
$CustData =~ s/^Transaction Time:.+//; # lose the beginning pattern
$CustData =~ s/^\d\d\d-\d\d\d-\d\d\d\d$//; # lose the ending pattern
next if ($CustData =~ m/^$/); # skip the blank lines
$CustData =~ s/\n//g; # get rid of blank lines. don't think this working
print "\t$CustData\n";
}
}
close IN;
print "\nAll done.\n";
The problem seems to be that $CustData holds all 5 lines. I need to
break out each of the lines into a separate string variable so as to
populate a database field. This is what has me stumped. Sure would
appreciate some light on this.
--
Amer Neely
------------------------------
Date: Sun, 9 Apr 2006 04:42:04 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules at Sun Apr 9 2006
Message-Id: <IxFuE4.Dy8@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Lingua-EL-Poly2Mono-0.01
http://search.cpan.org/~sprout/Lingua-EL-Poly2Mono-0.01/
Convert polytonic Greek to monotonic
----
HTML-LinkChanger-1.3
http://search.cpan.org/~sergeyche/HTML-LinkChanger-1.3/
abstract Perl class to change all linking URLs in HTML.
----
Apache-Logmonster-2.77
http://search.cpan.org/~msimerson/Apache-Logmonster-2.77/
----
XML-Atom-SimpleFeed-0.8_002
http://search.cpan.org/~aristotle/XML-Atom-SimpleFeed-0.8_002/
No-fuss generation of Atom syndication feeds
----
Net-OpenSRS-0.02
http://search.cpan.org/~mahlon/Net-OpenSRS-0.02/
----
DBIx-Class-0.06001
http://search.cpan.org/~jrobinson/DBIx-Class-0.06001/
Extensible and flexible object <-> relational mapper.
----
Rose-DateTime-0.522
http://search.cpan.org/~jsiracusa/Rose-DateTime-0.522/
DateTime helper functions and objects.
----
Mail-ListDetector-0.34
http://search.cpan.org/~mstevens/Mail-ListDetector-0.34/
Perl extension for detecting mailing list messages
----
Mail-ListDetector-0.33
http://search.cpan.org/~mstevens/Mail-ListDetector-0.33/
Perl extension for detecting mailing list messages
----
Gtk2-1.121
http://search.cpan.org/~tsch/Gtk2-1.121/
Perl interface to the 2.x series of the Gimp Toolkit library
----
Catalyst-Log-Log4perl-0.3
http://search.cpan.org/~holoway/Catalyst-Log-Log4perl-0.3/
Log::Log4perl logging for Catalyst
----
WWW-Myspace-0.39
http://search.cpan.org/~grantg/WWW-Myspace-0.39/
Access MySpace.com profile information from Perl
----
Catalyst-Log-Log4perl-0.2
http://search.cpan.org/~holoway/Catalyst-Log-Log4perl-0.2/
Log::Log4perl logging for Catalyst
----
Test-Run-0.0100_08
http://search.cpan.org/~shlomif/Test-Run-0.0100_08/
----
Test-Run-CmdLine-Plugin-ColorSummary-0.0100_01
http://search.cpan.org/~shlomif/Test-Run-CmdLine-Plugin-ColorSummary-0.0100_01/
Color the summary in Test::Run::CmdLine.
----
Test-Run-Plugin-ColorSummary-0.0100_00
http://search.cpan.org/~shlomif/Test-Run-Plugin-ColorSummary-0.0100_00/
A Test::Run plugin that colors the summary.
----
ExtUtils-XSBuilder-0.28
http://search.cpan.org/~grichter/ExtUtils-XSBuilder-0.28/
Automatic Perl XS glue code generation
----
Embperl-2.2.0
http://search.cpan.org/~grichter/Embperl-2.2.0/
Building dynamic Websites with Perl
----
File-Find-Rule-Perl-0.01
http://search.cpan.org/~adamk/File-Find-Rule-Perl-0.01/
Common rules for searching for Perl things
----
Catalyst-Plugin-XMLRPC-1.0
http://search.cpan.org/~sri/Catalyst-Plugin-XMLRPC-1.0/
Dispatch XMLRPC methods with Catalyst
----
XML-TreePP-0.08
http://search.cpan.org/~kawasaki/XML-TreePP-0.08/
Pure Perl implementation for parsing/writing xml file
----
Net-OpenID-Consumer-Yadis-0.01
http://search.cpan.org/~kokogiko/Net-OpenID-Consumer-Yadis-0.01/
library for consumers of OpenID identities, which uses Yadis protocol to search identity
----
File-Find-Rule-VCS-1.00
http://search.cpan.org/~adamk/File-Find-Rule-VCS-1.00/
Exclude files/directories for Version Control Systems
----
Catalyst-Plugin-Flavour-0.029_01
http://search.cpan.org/~typester/Catalyst-Plugin-Flavour-0.029_01/
Catalyst plugin for request flavours.
----
CGI-Application-Plugin-AutoRunmode-0.13
http://search.cpan.org/~thilo/CGI-Application-Plugin-AutoRunmode-0.13/
CGI::App plugin to automatically register runmodes
----
Net-GPSD-0.18
http://search.cpan.org/~mrdvt/Net-GPSD-0.18/
Provides a perl interface to the gpsd daemon.
----
Apache-SWIT-0.1
http://search.cpan.org/~bosu/Apache-SWIT-0.1/
mod_perl based application server with integrated testing.
----
Net-GPSD-0.17
http://search.cpan.org/~mrdvt/Net-GPSD-0.17/
Provides a perl interface to the gpsd daemon.
----
Net-GPSD-0.16
http://search.cpan.org/~mrdvt/Net-GPSD-0.16/
Provides a perl interface to the gpsd daemon.
----
Chroniton-0.01_2
http://search.cpan.org/~jrockway/Chroniton-0.01_2/
simple backup system with archiving and incremental backups
----
App-Info-0.49
http://search.cpan.org/~dwheeler/App-Info-0.49/
Information about software packages on a system
----
Net-Yadis-Discovery-0.05
http://search.cpan.org/~kokogiko/Net-Yadis-Discovery-0.05/
Perl extension for discovering Yadis document from Yadis URL
----
DCOP-0.036
http://search.cpan.org/~jcmuller/DCOP-0.036/
Perl extension to speak to the dcop server via system's DCOP client.
----
DCOP-Amarok-Playlist-0.007
http://search.cpan.org/~jcmuller/DCOP-Amarok-Playlist-0.007/
Perl extension to speak to an amaroK player object via system's DCOP.
----
DCOP-Amarok-Player-0.036
http://search.cpan.org/~jcmuller/DCOP-Amarok-Player-0.036/
Perl extension to speak to an amaroK player object via system's DCOP.
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Sun, 9 Apr 2006 04:23:12 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: XS progamming question
Message-Id: <e1a27g$5av$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de>], who wrote in article <49pjqmFq0f8lU1@news.dfncis.de>:
> > > That's true if x is a valid Perl identifier (a variable name without
> > > the sigil $, %, ..., * in our case), which "3" isn't.
> > "3" is. Witness $3, @3, %3, *3 etc.
> > perl -wle '%5 = (fpp => 23); *3 = \%5; print $3{fpp}'
> That is really a matter of terminology. With most computer languages
> an identifier is something that starts with a non-digit. I prefer that
> view for Perl too, while $3, @3, etc. are exceptional variables whose
> names are *not* identifiers.
Then your sentences should have been:
"That's true if x is a valid Anno's identifier"
1/2 ;-)
Ilya
------------------------------
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 9134
***************************************