[19794] in Perl-Users-Digest
Perl-Users Digest, Issue: 1989 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 23 06:10:31 2001
Date: Tue, 23 Oct 2001 03:10:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1003831811-v10-i1989@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 23 Oct 2001 Volume: 10 Number: 1989
Today's topics:
Parsing a 1gb tilde separated flat file <bob.trieger@fmr.com>
Re: Parsing a 1gb tilde separated flat file <uri@sysarch.com>
Re: Parsing a 1gb tilde separated flat file <goldbb2@earthlink.net>
Re: Parsing a 1gb tilde separated flat file (Logan Shaw)
Re: Parsing a 1gb tilde separated flat file <simon.oliver@umist.ac.uk>
Re: Parsing a 1gb tilde separated flat file <bart.lateur@skynet.be>
Re: Perl Image::Magick ignores QUALITY directive. (Martien Verbruggen)
Re: Perl Vs. Java <comdog@panix.com>
Re: Perl Vs. Java <hafner@augusta.de>
Re: Perl Vs. Java <bart.lateur@skynet.be>
Postgresql and Large Objects <ralf.ullrich@i-dmedia.com>
Re: Postgresql and Large Objects <goldbb2@earthlink.net>
Re: Premature end of script header (Martien Verbruggen)
Re: Premature end of script header <diehard@nospam.userve.co.uk>
Problem installing lcwa-1.0.0 <benlowe@davros.tardis.ed.ac.uk>
Re: Skipping following lines if the same (Martien Verbruggen)
Splitting a WML document with Perl <joonas@olen.to>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 22 Oct 2001 16:48:56 -0400
From: Bob T <bob.trieger@fmr.com>
Subject: Parsing a 1gb tilde separated flat file
Message-Id: <3BD48638.2DD3F8EF@fmr.com>
I'm parsing a 1 gb, tilde separated, flat file. There are
approximately 900,000 rows and 140 columns in each row. All I need to
do is extract 35 of these columns to a new tilde separated file after
stripping the 1st, 2nd and last row.
I am having no problem getting the job done but it is taking a lot
longer than I want it to and I was hoping that I could get some insight
here.
Below is the crux of what I am currently doing:
* @fields is a list of column numbers.
* badThingsHappen is an exit routine.
************ Begin Snippet *****************
open INFILE, "$infile" or badThingsHappen("Can't open input $infile:
$!");
open OUTFILE,">$outfile" or badThingsHappen("Can't open output $outfile:
$!");
while (<INFILE>) {
next if ($. < 3); # Omit header and description rows.
last if (/IMATRL/); # Omit trailer row.
chomp; # Remove newline from current row.
my @temp = split /~/;
my @work;
push @work,$temp[$_] for (@fields); # Put selected columns in list.
my $temp = join '~',@work; # Separate columns with a
tilde.
print OUTFILE "$temp\n"; # Write the line to output.
}
close INFILE;
close OUTFILE;
**************** End Snippet ***************
Thanks,
Bob Trieger
------------------------------
Date: Tue, 23 Oct 2001 07:58:26 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Parsing a 1gb tilde separated flat file
Message-Id: <x7vgh63hyp.fsf@home.sysarch.com>
>>>>> "BT" == Bob T <bob.trieger@fmr.com> writes:
BT> I'm parsing a 1 gb, tilde separated, flat file. There are
BT> approximately 900,000 rows and 140 columns in each row. All I need to
BT> do is extract 35 of these columns to a new tilde separated file after
BT> stripping the 1st, 2nd and last row.
BT> I am having no problem getting the job done but it is taking a lot
BT> longer than I want it to and I was hoping that I could get some insight
BT> here.
BT> open INFILE, "$infile" or badThingsHappen("Can't open input $infile:
BT> $!");
BT> open OUTFILE,">$outfile" or badThingsHappen("Can't open output $outfile:
BT> $!");
good, checking for open status.
BT> my @temp = split /~/;
BT> my @work;
BT> push @work,$temp[$_] for (@fields); # Put selected columns in list.
BT> my $temp = join '~',@work; # Separate columns with a
that can be sped up by using an array slice and no temp vars:
BT> print OUTFILE "$temp\n"; # Write the line to output.
<untested as i don't have his file :) >
print OUTFILE join( '~', (split( /~/ ))[@fields] ), "\n" ;
ain't perl fun?
consider how much extra copying and data munging that one line saves and
multiply it over 900k times. i bet the real loser was the push/for loop
vs. the array slice. try to keep inside the perl interpreter as much as
possible. it is fast c vs slow perl.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Tue, 23 Oct 2001 04:17:11 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Parsing a 1gb tilde separated flat file
Message-Id: <3BD52787.F57B09A0@earthlink.net>
Bob T wrote:
>
> I'm parsing a 1 gb, tilde separated, flat file. There are
> approximately 900,000 rows and 140 columns in each row. All I need to
> do is extract 35 of these columns to a new tilde separated file after
> stripping the 1st, 2nd and last row.
>
> I am having no problem getting the job done but it is taking a lot
> longer than I want it to and I was hoping that I could get some
> insight here.
>
> Below is the crux of what I am currently doing:
>
> * @fields is a list of column numbers.
[snip]
> while (<INFILE>) {
> next if ($. < 3); # Omit header and description rows.
> last if (/IMATRL/); # Omit trailer row.
> chomp; # Remove newline from current row.
> my @temp = split /~/;
> my @work;
> push @work,$temp[$_] for (@fields);#Put selected columns in list.
> my $temp = join '~',@work; #Separate columns with a tilde.
> print OUTFILE "$temp\n"; #Write the line to output.
> }
Try code like this:
<INFILE> for 1 .. 2; # omit first three lines.
my $oldselected = select OUTFILE;
my ($max) = sort {$b <=> $a} @fields;
if( $max == 139 && $fields[-1] == $max ) {
local $, = "~";
my $line = <INFILE>;
while( <INFILE> ) {
print +(split /~/, $line)[@fields];
} continue {
$line = $_;
}
} elsif( $max == 139 ) {
my $line = <INFILE>;
while( <INFILE> ) {
chomp;
print join("~", (split /~/, $line)[@fields]), "\n";
} continue {
$line = $_;
}
} else {
$max += 2;
my $line = <INFILE>;
while( <INFILE> ) {
print join("~",(split /~/, $line, $max)[@fields]), "\n";
} continue {
$line = $_;
}
}
select $oldselected;
This tries to put the minimum amount of code inside the loop, and move
as much as possible outside.
The first part of the if requires some assumptions to be true: There
must be 140 columns in every row, so that (split(/~/,$line))[139] will
have a newline on it, and 139 doesn't occur anywhere in @fields except
as the last element. As a result, column 139 will be passed from input
to output with the newline intact, without a need to chomp or add a
newline.
The second part of the if doesn't make any assumptions about the data.
The third part assumes that there are more columns in the input than
$max, and so the column with the newline is not one of the ones among
the slice (split /~/, $line, $max)[@fields], so there should be no need
to chomp. Adding 2 to $max is done because otherwise I would have to do
split(..., $max+2), and I want to factor out the +2.
In all 3 versions, I read a line before the while, and always work on
the prior line read. This means that I stop processing one line before
the last in the file... so I don't need to "know" that /IMATRL/ occurs
in the last line.
--
Klein bottle for rent - inquire within.
------------------------------
Date: 23 Oct 2001 03:38:42 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Parsing a 1gb tilde separated flat file
Message-Id: <9r3aai$490$1@charity.cs.utexas.edu>
In article <3BD48638.2DD3F8EF@fmr.com>, Bob T <bob.trieger@fmr.com> wrote:
> I'm parsing a 1 gb, tilde separated, flat file. There are
>approximately 900,000 rows and 140 columns in each row.
>
>* @fields is a list of column numbers.
>* badThingsHappen is an exit routine.
>while (<INFILE>) {
> next if ($. < 3); # Omit header and description rows.
> last if (/IMATRL/); # Omit trailer row.
> chomp; # Remove newline from current row.
> my @temp = split /~/;
> my @work;
> push @work,$temp[$_] for (@fields); # Put selected columns in list.
> my $temp = join '~',@work; # Separate columns with a
>tilde.
> print OUTFILE "$temp\n"; # Write the line to output.
>}
I suggest trying the following changes:
(1) Remove the "next if" line; read the first two lines in advance
instead. That way, you don't have to do that test every time
through the loop when it's only ever true 2 times and it's false
the other 899,998 times.
(2) Use an array slice instead of looping across @fields.
(3) Eliminate your temporary arrays; since you're using my(), I
believe they're created from scratch on each iteration of the
loop, and that's costly. (Presumably they have to be re-extended
every time, too, since a new array isn't big enough to hold 140
elements.)
That would make it look something like this:
# throw away first two lines
for (1 .. 2)
{
die unless scalar <INFILE>;
}
while (<INFILE>)
{
last if /IMATRL/;
chomp;
print OUTFILE join ("~", (split /~/)[@fields]), "\n";
}
A few other changes to thing about:
(4) If you're really desperate for speed, you can remove the "last if"
line from the loop too. Just print the line to the output file,
then go back through the output file (using seek(), etc.) and
delete it.
(5) You may not actually need to test <INFILE> and check if it
doesn't contain IMATRL. If the way you specified the problem is
correct, the last line *always* has IMATRL on it, so you can look
for that instead of end-of-file.
(6) If the value of @fields is such that you are never printing
the last field on the line, you don't need to do a chomp. This
will leave an extra "\n" in your last field, but you don't care.
(7) Since you're searching for a fixed string ("IMATRL"), maybe
last if substr ($_, 'IMATRL');
would be faster than
last if /IMATRL/;
or maybe not, since regular expressions are probably very
carefully optimized.
(8) It seems like maybe there would be a way to avoid having
to do a join() when maybe you could just print everything straight
from your array. That would avoid some copying, but it seems like
it would also make things too complicated.
Then again, I guess you could change your
split (/~/)
to a
split (/(~)/)
so that your array would have the tildes already in it. You'd
have to modify your @fields list ahead of time, but maybe that
wouldn't be so bad. For example, if your input were
a1~b2~c3~d4
and you wanted to print fields 0 and 2, you can build this
array:
("a1", "b2", "c3", "d4")
and print like this:
print join ("~", (split (/~/))[0,2]), "\n";
or, you can build this array:
("a1", "~", "b2", "~", "c3", "~", "d4")
and print like this:
print (split (/(~)/))[0,1,4], "\n";
I don't know which one is slower or faster, because probably one
spends less time building the array, and the other spends less
time formatting it for output.
Of course, despite all these suggestions, you may find that your
program is I/O bound anyway.
A completely different strategy is to read big chunks of your file into
memory at once (a few megabytes). Then have a big ugly regular
expression substitution do all the work for you. If you only had three
fields and you wanted the first and last, that might look something
like this:
$chunk =~ s/^([^~]+)~[^~]+~([^~]+)$/$1~$3/gm;
You can build the big ugly regular expression automatically based on
the value of @fields. The trick with this method, though, would be
reading in big chunks of the file that happen to fall on line
boundaries. That would be a bit of a pain.
- Logan
--
"In order to be prepared to hope in what does not deceive,
we must first lose hope in everything that deceives."
Georges Bernanos
------------------------------
Date: Tue, 23 Oct 2001 09:49:16 +0100
From: Simon Oliver <simon.oliver@umist.ac.uk>
Subject: Re: Parsing a 1gb tilde separated flat file
Message-Id: <3BD52F0C.E6E544BA@umist.ac.uk>
Without running any tests I guess the follwoing would be quicker because
it removes a for loop and saves copying elements from one array to
another (@temp->@work):
while (<INFILE>) {
next if ($. < 3); # Omit header and description rows.
last if (/IMATRL/); # Omit trailer row.
chomp; # Remove newline from current row.
my $temp = join '~', (split /~/)[@fields];
print OUTFILE "$temp\n"; # Write the line to output.
}
--
Simon Oliver
> I'm parsing a 1 gb, tilde separated, flat file. There are
> approximately 900,000 rows and 140 columns in each row. All I need to
> do is extract 35 of these columns to a new tilde separated file after
> stripping the 1st, 2nd and last row.
>
> I am having no problem getting the job done but it is taking a lot
> longer than I want it to and I was hoping that I could get some insight
> here.
>
------------------------------
Date: Tue, 23 Oct 2001 09:24:32 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Parsing a 1gb tilde separated flat file
Message-Id: <shdatto6cgfook19633eaknbnfc14b5gs0@4ax.com>
Bob T wrote:
>Below is the crux of what I am currently doing:
>
>* @fields is a list of column numbers.
>* badThingsHappen is an exit routine.
>
>************ Begin Snippet *****************
>
>open INFILE, "$infile" or badThingsHappen("Can't open input $infile:
>$!");
>open OUTFILE,">$outfile" or badThingsHappen("Can't open output $outfile:
>$!");
>
>while (<INFILE>) {
> next if ($. < 3); # Omit header and description rows.
move this out of the loop
> last if (/IMATRL/); # Omit trailer row.
maybe this too... shouldn't you anchor this regex?
> chomp; # Remove newline from current row.
> my @temp = split /~/;
> my @work;
> push @work,$temp[$_] for (@fields); # Put selected columns in list.
> my $temp = join '~',@work; # Separate columns with a
>tilde.
> print OUTFILE "$temp\n"; # Write the line to output.
Too much work. I'd set $\ and $, ionf front of this loop, and use a
slice to get what you want
>}
>
>close INFILE;
>close OUTFILE;
Here's my approach:
($\, $,) = ("\n", "~");
<INFILE>; <INFILE>;
while (<INFILE>) {
last if (/IMATRL/); # Omit trailer row.
chomp; # Remove newline from current row.
print OUTFILE (split /~/)[@fields]; # Write the selection to output.
}
--
Bart.
------------------------------
Date: Tue, 23 Oct 2001 04:27:40 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Perl Image::Magick ignores QUALITY directive.
Message-Id: <slrn9t9sds.1bv.mgjv@verbruggen.comdyn.com.au>
On Tue, 23 Oct 2001 02:39:33 GMT,
Brian P. Barnes <BrianP@Die_Spammers_Fractasia.com> wrote:
> Hi,
>
> I am upgrading an old tool to make it faster and easier on the images. I
> used to use Image Magick's convert.exe repeatedly to resize, rotate,
> annotate and thumbnail each pic. Now, I use Perl Magick $Image->Read and
> do everything in memory with no file re-reads from disk and no disk
> writes until all the processing is done.
>
> I used to use "convert.exe -quality $quality -compress JPEG $infile
> $outfile" in a system command and the quality was honored.
>
> Now I use
> $err = $image->Read("$infile"); # Read the Fully Qualified Path.
> $err = $image->Set(compression => "JPEG");
> $err = $image->Set(quality => $quality);
> $err = $image->write(compression => "JPEG", quality => $quality,
IM methods are generally written with a leading lowercase letter.
Why do you set compression and quality both as image options as well
as Write options? Only one should be needed.
> filename => "$outfile");
I run the following program:
#!/usr/local/bin/perl -w
use strict;
use Image::Magick;
my ($infile, $quality, $outfile) = @ARGV;
$outfile || die;
my $image = Image::Magick->new();
my $err = $image->Read($infile); # Read the Fully Qualified Path.
die $err if $err;
$err = $image->Set(compression => "JPEG");
die $err if $err;
$err = $image->Set(quality => $quality);
die $err if $err;
$err = $image->Write($outfile);
die $err if $err;
__END__
as follows:
$ /tmp/foo.pl leopard.tiff 15 foo.jpg
Varying the number between 15 and 95.
I get very, very different results, based on the quality. The same
happens if I specify the quality and compression method in the Write
method, instead of separately.
Perl 5.6.1 built for i586-linux
ImageMagick 5.4.0
Martien
--
Martien Verbruggen | My friend has a baby. I'm writing
| down all the noises the baby makes so
Trading Post Australia Pty Ltd | later I can ask him what he meant -
| Steven Wright
------------------------------
Date: Tue, 23 Oct 2001 01:37:46 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Perl Vs. Java
Message-Id: <comdog-8F64AD.01374623102001@news.panix.com>
In article <PO$b#qyWBHA.169@hqp_news_nt1.corp.rhalf.com>, "Krishna
Kumar" <krishna.kumar@rhii.com> wrote:
> Folks at my work are talking about using Java as a standard instead of Perl.
>
> I have no knowledge of Java to agree or disagree with this.
>
> They are trying to convince me that Java can do everything that Perl can.
talking about which tool to use before you know what you are
building is a bit silly. figure out what you want to do then
choose the tool that makes the most sense for that problem.
and, despite this seemingly tolerant perspective, i have never
chosen Java as the right tool for the job. i've chosen things
other than Perl, including C, Tcl, Python, and even sh, but never
Java. that might be because i haven't worked on the problems
where Java's strengths prevail. as i understand it Java has
some kickass XML stuff, for instance. if you are in one of
those problem domains, Java might be the right choice.
so, walk softly and carry a big toolbox. :)
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: 23 Oct 2001 09:08:03 +0200
From: Walter Hafner <hafner@augusta.de>
Subject: Re: Perl Vs. Java
Message-Id: <qdfg08a4ywc.fsf@www.ibexnet.de>
ted <tlav1@mediaone.net> writes:
> Java crashes browsers MUCH better hat Perl. : )
That is nonsense, of course.
The OP is talking about server-sided java code, aka 'servlets'. Just
like Perl, servlets generate what you tell it to.
As for the original question: I'd stick to Perl if the scripts work and
if there's still room for improvement. If you experience problems with a
single application and everything else works well, consider rewriting
the offending application (speed up your Perl code, use mod_perl or
fastcgi instead of CGI, whatever) or use a different, better performing
language (whatever THAT means :-)
I'd only think about changing the complete programming environment if
I'd experience systematic problems, e.g. performance problems, code
maintainability, versioning, proprietary interfaces, etc.
Another reason might be an integrated environment: If you use a content
manager/eCommerce package you might be stuck to the supported script
language ... (been there, done that ...)
-Walter
------------------------------
Date: Tue, 23 Oct 2001 08:50:54 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl Vs. Java
Message-Id: <6aaattkmlojnb44aribocao63hd0unt8i9@4ax.com>
Krishna Kumar wrote:
>No I think the assumption is Java is easier to learn than Perl.
Maybe... but Java programs will mùost likely be a lot more verbose than
Perl programs.
And BASIC is easier to learn than Java... so let's do it in BASIC?
I think not.
I think that Perl is more powerful than Java. More... to the point. And
I'm currently in the process of learning Java.
>Unfortunately Perl needs to hire some marketing folks from M$ or Sun as some
>of our managers had not even heard of Perl until this discussion cropped up.
Not M$. They seems to be determined to kill of Java. See the article on
M$'s attempts of sabotaging Java, a few years ago, and their current
decision of not including the Java Runtime in their new OS, XP.
<http://www.javacoffeebreak.com/articles/microsoftjava/index.html>
<http://www.wired.com/news/business/0,1367,45338,00.html>
The decision from Microsoft to drop Java like a hot potato, is simply
because they were not allowed to "embrace and extend" it. They ARE
allowed to include a very recent Java standards compatible engine.
Do you want the same faith for Perl?
--
Bart.
------------------------------
Date: Tue, 23 Oct 2001 11:07:37 +0200
From: ralf ullrich <ralf.ullrich@i-dmedia.com>
Subject: Postgresql and Large Objects
Message-Id: <3BD53359.504@i-dmedia.com>
hi,
does anybody have a working example of inserting a large object into
psotgresql via cgi using DBI?
I tried the functions mentioned in perldoc DBD::pg ($lobjId =
$dbh->func($mode, 'lo_creat')), which returns an objectID, but still I
cant insert the blob (eg a gif-image).
Has anybody an idea?
Thanks,
Ralf
------------------------------
Date: Tue, 23 Oct 2001 05:50:23 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Postgresql and Large Objects
Message-Id: <3BD53D5F.1FF4F214@earthlink.net>
ralf ullrich wrote:
>
> hi,
>
> does anybody have a working example of inserting a large object into
> psotgresql via cgi using DBI?
> I tried the functions mentioned in perldoc DBD::pg ($lobjId =
> $dbh->func($mode, 'lo_creat')), which returns an objectID, but still I
> cant insert the blob (eg a gif-image).
>
> Has anybody an idea?
Have you considered just inserting it as an ordinary text field?
Of course, you have have your table configured so the field is VARCHAR
or whatever, not BLOB, but this shouldn't be too hard.
--
Klein bottle for rent - inquire within.
------------------------------
Date: Tue, 23 Oct 2001 04:42:11 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Premature end of script header
Message-Id: <slrn9t9t93.1bv.mgjv@verbruggen.comdyn.com.au>
On Tue, 23 Oct 2001 11:33:59 +0800,
Terence Smith <mjojoz@nospamhotmail.com> wrote:
> Hi all,
>
> I need an advice from all of you about this perl program.
You have already had two posts outlining several problems with your
program. However, I'd like to point out to you that the Perl FAQ,
section 9 deals specifically with CGI programs, and how to debug them
and how to get meaningful error messages. Please take some time to
read it.
The Perl FAQ is installed wherever Perl is installed. You can access
it with the perldoc command (perldoc perlfaq9, also try perldoc
perldoc and perldoc perl), as well as as HTML on ActiveState
installations. Mac users need to use Shuck.
> When I try to run this program from my webbrowser always return error 500.
> If I check on error log on my webserver state that "Premature end of script
> header". Thank for any advice in advance.
What you should start doing is running your scripts from the command
line, before running them from a Web server.
Martien
--
Martien Verbruggen |
| Hi, Dave here, what's the root
Trading Post Australia Pty Ltd | password?
|
------------------------------
Date: Tue, 23 Oct 2001 09:22:54 +0100
From: "Diehard Duck" <diehard@nospam.userve.co.uk>
Subject: Re: Premature end of script header
Message-Id: <1003825380.8004.0.nnrp-08.9e98e2c7@news.demon.co.uk>
>
> When I try to run this program from my webbrowser always return error 500.
> If I check on error log on my webserver state that "Premature end of
script
> header". Thank for any advice in advance.
>
> #!c:\perl_prog\bin\perl
print "Content-type: text/html\n\n";
Will let the browser know what sort of content you are trying to send.
Without it the browser doesn't know what to do. Put it straight under the
#!C:\... line.
DD
------------------------------
Date: 23 Oct 2001 08:46:16 GMT
From: Ben Lowe <benlowe@davros.tardis.ed.ac.uk>
Subject: Problem installing lcwa-1.0.0
Message-Id: <9r3aon$ebi$1@kane.dcs.ed.ac.uk>
I have a problem installing the CPAN modules lcwa-1.0.0.
Below is the output I get when I run configure and then make. The system I am trying to install on is :
OS Release: Solaris 8 6/00 s28s_u1wos_08 SPARC
Kernel Configured: 64-bit
Platform: SUNW,Ultra-60
Anyway below is the output I get. Any help would be much apprecited.
./configure
./etc/newvers: /tmp/getopt: not found
Configuring for LCWA /usr/ucb/cc: language optional software package not instled
Usage: newvers [options] versionfile
Options are:
-l<lang> set language to one of "txt", "c" or "perl"
-p<progname> set program name
-r<v>.<r>[.pb]<p> set release version string
-i{v|r|P|p|b|a|s} increase version, revision or {alpha,batch,patch,snalevel
-d display current version only
-D display current version only (incl. date)
-V print NEWVERS version
-h print help page
loading cache ./config.cache
checking whether make sets ${MAKE}... (cached) yes
checking for a BSD compatible install... etc/install-sh -c
checking for Perl interpreter... expr: syntax error
expr: syntax error
/usr/dist/exe/perl5 v5.003
checking for MakeMaker's private install paths... ok
creating ./config.status
creating Makefile
creating lib/Makefile
creating lcwa_boot.pl
creating etc/expand
creating etc/crunch
make
./etc/expand lcwa_main.pl | ./etc/crunch README >lcwa.tmp
./etc/crunch: =: not found
./etc/crunch: syntax error at line 12: `;' unexpected
make: *** [lcwa] Error 2
(rmc-emea-dev)bl129169:./etc/expand: sub: not found
./etc/expand: syntax error at line 12: `local' unexpected
--
------------------------------
Date: Tue, 23 Oct 2001 04:29:57 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Skipping following lines if the same
Message-Id: <slrn9t9si5.1bv.mgjv@verbruggen.comdyn.com.au>
On Mon, 22 Oct 2001 23:47:26 -0400,
Benjamin Goldberg <goldbb2@earthlink.net> wrote:
> Martien Verbruggen wrote:
>>
>> On Mon, 22 Oct 2001 20:43:59 -0400,
>> Benjamin Goldberg <goldbb2@earthlink.net> wrote:
> [snip]
>> >> skipping following lines if the same.
>> >> But only following lines.
>> >
>> > [untested]:
>> > my %seen;
>> > while(<IN>) {
>> > next if exists $seen{$_} && $seen{$_} == $. - 1;
>> > print;
>> > $seen{$_} = $.;
>> > }
>>
>> But this will also transform
[snip]
>
> No it won't, due to the " && $seen{$_} == $. - 1" clause.
Oops. You're right. Sorry.
> Of course, it occurs to me that the unix program uniq should also be
> able to do what the OP wants.
I thought about saying that, but the OP stated so clearly that they
had an array with those values, and not a file. Piping the contents of
an array to uniq, and capturing the output would be more work than
just grepping or mapping or so.
Martien
--
Martien Verbruggen |
| I used to have a Heisenbergmobile.
Trading Post Australia Pty Ltd | Every time I looked at the
| speedometer, I got lost.
------------------------------
Date: Tue, 23 Oct 2001 08:40:22 GMT
From: Joonas Paalasmaa <joonas@olen.to>
Subject: Splitting a WML document with Perl
Message-Id: <3BD52D97.BCA57088@olen.to>
I want to split a large WML document into smaller ones those size
must not exceed 1500 characters.
Any ideas?
------------------------------
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.
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 1989
***************************************