[19949] in Perl-Users-Digest
Perl-Users Digest, Issue: 2144 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 16 21:06:11 2001
Date: Fri, 16 Nov 2001 18:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1005962711-v10-i2144@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 16 Nov 2001 Volume: 10 Number: 2144
Today's topics:
ActivePerl 5.6.1 and Internal Error 2355 <twist@o2.pl>
Binary issues.. <mds@wam.umd.edu>
Re: Binary issues.. (Clinton A. Pierce)
Re: Binary issues.. <mgjv@tradingpost.com.au>
Re: Binary issues.. <flavell@mail.cern.ch>
Re: Binary issues.. <vze33mmh@verizon.net>
Book on PERL projects? nospam@nospam.com
Re: Book on PERL projects? <darkon@one.net>
Re: Book on PERL projects? <nobody@nowhere.com>
Chat? <jarulekgh@wanadoo.fr>
Re: Chat? <roger_faust@bluewin.ch>
Re: Chat? <nobody@nowhere.com>
Re: end-of-file <jurgenex@hotmail.com>
Exact match with the Regular expression (Sam)
Re: Exact match with the Regular expression <vze33mmh@verizon.net>
Re: Exact match with the Regular expression <mikesl@wrq.com>
Re: Exact match with the Regular expression <spam@thecouch.homeip.net>
Re: Exact match with the Regular expression <mikesl@wrq.com>
Re: Extracting number from an string <vze33mmh@verizon.net>
Fast Portable Logical Shift Right in Perl ? <shelorm@earthlink.net>
How can I use LWP::Simple inside a safe compartment? (Christoph Bergmann)
how to create a file that doesn't exist? <no_mto@hotmail.com>
Re: how to create a file that doesn't exist? <spam@thecouch.homeip.net>
Re: how to create a file that doesn't exist? <Jon.Ericson@jpl.nasa.gov>
Re: html2txt (HTML to Text) without using lynx (Clinton A. Pierce)
Re: html2txt (HTML to Text) without using lynx <mikesl@wrq.com>
Re: html2txt (HTML to Text) without using lynx <flavell@mail.cern.ch>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 16 Nov 2001 22:05:49 +0100
From: "Twist" <twist@o2.pl>
Subject: ActivePerl 5.6.1 and Internal Error 2355
Message-Id: <9t3vha$s7o$1@news.tpi.pl>
I am attempting to install Active.. on a Windows 98 platform
and received the following error: "Internal Error 2355". Has anyone had
any experience with this type of error? What should I do?
Is any way to resolve this problem?
------------------------------
Date: Fri, 16 Nov 2001 05:37:01 -0500
From: "Falco98" <mds@wam.umd.edu>
Subject: Binary issues..
Message-Id: <9t2qav$5lv$1@dailyplanet.wam.umd.edu>
I'm having a rather nasty problem with hybrid ascii/binary files.
I'm trying to process a large file with equal parts ascii (html, with very
few line returns), and binary (actual data files stored between <data> tags
in the HTML).
If you're curious, what I'm trying to do is chew up the super-huge AIM log
files, which dump every logged chat session (including drag-and-dropped
data) into one large HTML (now 100 megs on my system). It's going great,
except I'm finding no good way of reading the binary properly.
Thanks.
~Mike
------------------------------
Date: Sat, 17 Nov 2001 00:17:51 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Binary issues..
Message-Id: <P0iJ7.24356$RI2.13183149@news2>
[Posted and mailed]
In article <9t2qav$5lv$1@dailyplanet.wam.umd.edu>,
"Falco98" <mds@wam.umd.edu> writes:
> I'm having a rather nasty problem with hybrid ascii/binary files.
> I'm trying to process a large file with equal parts ascii (html, with very
> few line returns), and binary (actual data files stored between <data> tags
> in the HTML).
> If you're curious, what I'm trying to do is chew up the super-huge AIM log
> files, which dump every logged chat session (including drag-and-dropped
> data) into one large HTML (now 100 megs on my system). It's going great,
> except I'm finding no good way of reading the binary properly.
Perl has no problems with binary data. Since you mention AIM, is this Win32?
If so, remember to binmode() filehandles that might be involved in reading/
writing binary data. That's Windows' fault, not Perl's.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours *and*
clintp@geeksalad.org Perl Developer's Dictionary
"If you rush a Miracle Man, for details, see http://geeksalad.org
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Sat, 17 Nov 2001 11:31:04 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Binary issues..
Message-Id: <slrn9vbbu8.3j7.mgjv@martien.heliotrope.home>
On Fri, 16 Nov 2001 05:37:01 -0500,
Falco98 <mds@wam.umd.edu> wrote:
> I'm having a rather nasty problem with hybrid ascii/binary files.
> I'm trying to process a large file with equal parts ascii (html, with very
> few line returns), and binary (actual data files stored between <data> tags
> in the HTML).
There is no such thing as hybrid ascii/binary files as far as Perl is
concerned. A file is either a text file or a binary file. In this case,
it's a binary file.
> If you're curious, what I'm trying to do is chew up the super-huge AIM log
> files, which dump every logged chat session (including drag-and-dropped
> data) into one large HTML (now 100 megs on my system). It's going great,
> except I'm finding no good way of reading the binary properly.
open() it, binmode() the handle, then process with read. Find the <data>
and </data> start and end tags, and do what you need to do.
Martien
--
| The Second Law of Thermodenial: In
Martien Verbruggen | any closed mind the quantity of
| ignorance remains constant or
| increases.
------------------------------
Date: Sat, 17 Nov 2001 01:44:21 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Binary issues..
Message-Id: <Pine.LNX.4.30.0111170138370.14258-100000@lxplus023.cern.ch>
On Nov 17, Clinton A. Pierce inscribed on the eternal scroll:
> Perl has no problems with binary data. Since you mention AIM, is this Win32?
> If so, remember to binmode() filehandles that might be involved in reading/
> writing binary data. That's Windows' fault, not Perl's.
The distinction between binary and text files is _not_ exclusive to
OSes from the Great Monopolist; indeed the insistence by unixoid
systems that there be no difference between different kinds of files
is rather the exception than the rule.
Preserving the distinction between text-mode and binary-mode files
does no harm to unix: for portability reasons I'd recommend falling
into line with that, unless you aim to stamp yourself as a unix bigot
who is committed to damaging the portability that perl has rightfully
established for itself.
------------------------------
Date: Sat, 17 Nov 2001 00:55:19 GMT
From: sysop <vze33mmh@verizon.net>
Subject: Re: Binary issues..
Message-Id: <pan.2001.11.16.20.04.29.3108.29362@verizon.net>
On Fri, 16 Nov 2001 05:37:01 -0500, Falco98 wrote:
> I'm having a rather nasty problem with hybrid ascii/binary files. I'm
> trying to process a large file with equal parts ascii (html, with very
> few line returns), and binary (actual data files stored between <data>
> tags in the HTML).
> If you're curious, what I'm trying to do is chew up the super-huge AIM
> log files, which dump every logged chat session (including
> drag-and-dropped data) into one large HTML (now 100 megs on my system).
> It's going great, except I'm finding no good way of reading the binary
> properly. Thanks.
> ~Mike
I assume you want to seperate out the data files into individual files
for some sort of inspection, and keep a version of the log file without
the included data files.
I ran into an interesting problem while working on a script to handle
what was required. It works exactly as expected, except it inserts
0x0a at the beginning of the file. :( There is an easy work around,
which is included in this script (but hey you gurus out there, I'd love
to know why this octet finds its way into the output when it isn't in
the input file itself):
log_parser.pl
#!/usr/bin/perl
open(IN, "log");
open(OUT, ">log.out");
$/="</data>"; #record seperator
while(<IN>){
if(m/<data>/){
s/<\/data>//;
s/(.*)<data>//s;
print OUT "$1\n";
s/\x0a//; # workaround to get rid of the wierdo 0x0a
open(DATA, ">data." . $a++);
print DATA;
close DATA;
}else{
print OUT "$_\n";
}
}
close IN;
close OUT;
Some info follows for anyone trying to help me understand the added
octet issue. Its a log of what I did. The first time I ran
log_parser.pl, it didn't have the s/\x0a//; work-around.
# dd count=1024 if=/dev/zero of=data_pre_0
# dd bs=8 count=1048576 if=/dev/zero of=data_pre_1
# echo "insert 1
<data>" > log
# cat data_pre_0 >> log
# echo "</data>insert 2<data>" >> log
# cat data_pre_1 >> log
# echo "</data>
insert 3" >> log
# ls -lA
-rw-rw-r-- 1 rob rob 524288 Nov 16 19:12 data_pre_0
-rw-rw-r-- 1 rob rob 8388608 Nov 16 19:14 data_pre_1
-rw-rw-r-- 1 rob rob 8912953 Nov 16 19:15 log
-rw-rw-r-- 1 rob rob 312 Nov 16 19:03 log_parser.pl
# perl log_parser.pl
# ls -lA
-rw-rw-r-- 1 rob rob 524289 Nov 16 19:23 data.0
-rw-rw-r-- 1 rob rob 8388609 Nov 16 19:23 data.1
-rw-rw-r-- 1 rob rob 524288 Nov 16 19:12 data_pre_0
-rw-rw-r-- 1 rob rob 8388608 Nov 16 19:14 data_pre_1
-rw-rw-r-- 1 rob rob 8912953 Nov 16 19:15 log
-rw-rw-r-- 1 rob rob 32 Nov 16 19:23 log.out
-rw-rw-r-- 1 rob rob 312 Nov 16 19:03 log_parser.pl
# xxd data_pre_0 > data_pre_0.xxd
# xxd data.0 > data.o.xxd
# diff data_pre_0.xxd data.0.xxd
1c1
< 0000000: 0000 0000 0000 0000 0000 0000 0000 0000 ................
---
> 0000000: 0a00 0000 0000 0000 0000 0000 0000 0000 ................
32768a32769
> 0080000: 00
# xxd log2 | grep \ 0a00
#
------------------------------
Date: Fri, 16 Nov 2001 21:06:54 +0000 (UTC)
From: nospam@nospam.com
Subject: Book on PERL projects?
Message-Id: <9t3v5e$6gh$1@flood.xnet.com>
At one time I read a book called "SQL for smarties" or something.
Anyway, it was basically a "quiz" book and presented real-world projects
and problems to solve. Is there anything even close for PERL?
please respond here - my email is down
------------------------------
Date: Fri, 16 Nov 2001 21:46:32 -0000
From: David Wall <darkon@one.net>
Subject: Re: Book on PERL projects?
Message-Id: <Xns915BAA74E677Adarkononenet@207.126.101.97>
nospam@nospam.com wrote on 16 Nov 2001:
> At one time I read a book called "SQL for smarties" or something.
>
> Anyway, it was basically a "quiz" book and presented real-world projects
> and problems to solve. Is there anything even close for PERL?
There's the _Perl Cookbook_, which presents solutions to all sorts of
problems. I've learned quite a bit from it, and expect to learn more.
http://www.oreilly.com/catalog/cookbook/
says:
The Perl Cookbook is a comprehensive collection of problems, solutions,
and practical examples for anyone programming in Perl. You'll find
hundreds of rigorously reviewed Perl "recipes" for manipulating strings,
numbers, dates, arrays, and hashes; pattern matching and text
substitutions; references, data structures, objects, and classes; signals
and exceptions; and much more.
--
David Wall
darkon@one.net
------------------------------
Date: Sat, 17 Nov 2001 08:39:11 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: Book on PERL projects?
Message-Id: <uxgJ7.324794$8x1.92397@newsfeeds.bigpond.com>
<nospam@nospam.com> wrote in message news:9t3v5e$6gh$1@flood.xnet.com...
> At one time I read a book called "SQL for smarties" or something.
>
> Anyway, it was basically a "quiz" book and presented real-world projects
> and problems to solve. Is there anything even close for PERL?
>
> please respond here - my email is down
Join an open source project!!!
Go to http://sourceforge.net/ search for Purl, and contribute!!
gtoomey
------------------------------
Date: Fri, 16 Nov 2001 20:03:50 +0100
From: "Wanadoo" <jarulekgh@wanadoo.fr>
Subject: Chat?
Message-Id: <9t3oak$en9c$1@as201.hinet.hr>
Hi!!!!!!
I wonder if is possible to make chat using HTML and Perl. Do I have to
know socket programming?? Where I can find more informations about this?
I think Perl can also be good for that purpose as Java, right?
Help nad thanks!
M.
------------------------------
Date: Thu, 15 Nov 2001 11:47:18 +0100
From: Roger Faust <roger_faust@bluewin.ch>
Subject: Re: Chat?
Message-Id: <3bf58974$1_1@news.bluewin.ch>
Wanadoo wrote:
> Hi!!!!!!
> I wonder if is possible to make chat using HTML and Perl. Do I have to
> know socket programming?? Where I can find more informations about this?
> I think Perl can also be good for that purpose as Java, right?
>
> Help nad thanks!
it is possible to do it in perl. you have 2 possiblities (if you wan't to
use your browser). one is to make a never anding stream to the browser (i
wouldn't do that, and maybe such a program will be killed by some servers,
or an other programm who is watching the system). the other is to use a
html page which reload's itselfes after some time and gets like that the
new data.
i personal would prefer java, since java makes it possible to program on
the user's browser (if it supports java).
>
> M.
>
>
>
>
>
--
Roger Faust
------------------------------
Date: Sat, 17 Nov 2001 08:41:33 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: Chat?
Message-Id: <IzgJ7.324796$8x1.92555@newsfeeds.bigpond.com>
"Wanadoo" <jarulekgh@wanadoo.fr> wrote in message
news:9t3oak$en9c$1@as201.hinet.hr...
> Hi!!!!!!
> I wonder if is possible to make chat using HTML and Perl. Do I have to
> know socket programming?? Where I can find more informations about this?
> I think Perl can also be good for that purpose as Java, right?
>
> Help nad thanks!
>
> M.
For examples of perl chat software see google:
http://www.google.com/search?sourceid=navclient&q=chat+perl
gtoomey
------------------------------
Date: Fri, 16 Nov 2001 14:25:02 -0800
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: end-of-file
Message-Id: <3bf5929b@news.microsoft.com>
"Newbie" <youradmirer@onebox.com> wrote in message
news:582bc82b.0111131313.7c37a300@posting.google.com...
> I'm using Open3 to communicate with another process that I have little
> control over (example included). The problem is that the other process
> waits for an EOF in the input stream from Open3 in order to proceed.
> How can I write an EOF to this input stream? Thanks.
You cannot. EOF is a condition, not a character (although sometimes by some
programs on some OSs some characters will be interpreted as an EOF).
Just close the filehandle.
jue
------------------------------
Date: 16 Nov 2001 14:19:54 -0800
From: trac6637@hotmail.com (Sam)
Subject: Exact match with the Regular expression
Message-Id: <820d061b.0111161419.2c9b3efc@posting.google.com>
I am newbie in Regular Expression world hence I need help from gurus
over here
I am giving an sql statement from a table and retreving values from
the a colum. The column contains values caxxxx, cxxxxx, baxxxxx and
bxxxx here all xxxx are numbers.
How can I contruct an example from it that will match and find exact
cxxxxx and bxxxx ignoring caxxxx and baxxxx
My sql server only allows me to give "select my_column from my_table
where My-column like 'c'" which results both caxxxx and cxxxxx
Thnx in advance
------------------------------
Date: Fri, 16 Nov 2001 23:48:55 GMT
From: sysop <vze33mmh@verizon.net>
Subject: Re: Exact match with the Regular expression
Message-Id: <pan.2001.11.16.19.01.22.22858.29362@verizon.net>
On Fri, 16 Nov 2001 17:19:54 -0500, Sam wrote:
> I am giving an sql statement from a table and retreving values from the
> a colum. The column contains values caxxxx, cxxxxx, baxxxxx and bxxxx
> here all xxxx are numbers.
>
> How can I contruct an example from it that will match and find exact
> cxxxxx and bxxxx ignoring caxxxx and baxxxx
>
> My sql server only allows me to give "select my_column from my_table
> where My-column like 'c'" which results both caxxxx and cxxxxx
You can probably write your sql to seperate the ca's from the c's. eg;
SELECT [columns] FROM [table] WHERE [column] like 'ca'*;
SELECT [columns] FROM [table] WHERE [column] like 'c0'* OR [column] like
'c1'* ... OR [column] like 'c9'*;
But a regexp will work with what you got now. Something like;
m/[cb]\d/ will match cxxxx or bxxxx but not caxxxx or baxxxx.
------------------------------
Date: Sat, 17 Nov 2001 00:17:59 GMT
From: Michael Slass <mikesl@wrq.com>
Subject: Re: Exact match with the Regular expression
Message-Id: <m3668auu6o.fsf@thneed.na.wrq.com>
trac6637@hotmail.com (Sam) writes:
>I am newbie in Regular Expression world hence I need help from gurus
>over here
>
>I am giving an sql statement from a table and retreving values from
>the a colum. The column contains values caxxxx, cxxxxx, baxxxxx and
>bxxxx here all xxxx are numbers.
>
>How can I contruct an example from it that will match and find exact
>cxxxxx and bxxxx ignoring caxxxx and baxxxx
>
>My sql server only allows me to give "select my_column from my_table
>where My-column like 'c'" which results both caxxxx and cxxxxx
>
>
>Thnx in advance
You want to match "c or b followed by one or more digits", which will
necessarily exclude ca...
[ab][0-9]+
--
Mike
------------------------------
Date: Fri, 16 Nov 2001 19:26:09 -0500
From: "Mina Naguib" <spam@thecouch.homeip.net>
Subject: Re: Exact match with the Regular expression
Message-Id: <M8iJ7.383$7T.112734@wagner.videotron.net>
"Michael Slass" <mikesl@wrq.com> wrote in message
news:m3668auu6o.fsf@thneed.na.wrq.com...
> trac6637@hotmail.com (Sam) writes:
>
> >I am newbie in Regular Expression world hence I need help from gurus
> >over here
> >
> >I am giving an sql statement from a table and retreving values from
> >the a colum. The column contains values caxxxx, cxxxxx, baxxxxx and
> >bxxxx here all xxxx are numbers.
> >
> >How can I contruct an example from it that will match and find exact
> >cxxxxx and bxxxx ignoring caxxxx and baxxxx
> >
> >My sql server only allows me to give "select my_column from my_table
> >where My-column like 'c'" which results both caxxxx and cxxxxx
> >
> >
> >Thnx in advance
>
> You want to match "c or b followed by one or more digits", which will
> necessarily exclude ca...
>
> [ab][0-9]+
I think Mike meant [cb][0-9]+
just a brain fart I'm sure since he wrote it right in the sentence right
above.
Also if your limitation is "1 character and numerals" as opposed to only c
or b, then you can use
/^[a-z][0-9]+$/i;
Sam, read `perldoc perlre` or
http://www.perldoc.com/perl5.6.1/pod/perlre.html
>
> --
> Mike
------------------------------
Date: Sat, 17 Nov 2001 00:29:28 GMT
From: Michael Slass <mikesl@wrq.com>
Subject: Re: Exact match with the Regular expression
Message-Id: <m3r8qytf33.fsf@thneed.na.wrq.com>
"Mina Naguib" <spam@thecouch.homeip.net> writes:
>"Michael Slass" <mikesl@wrq.com> wrote in message
>news:m3668auu6o.fsf@thneed.na.wrq.com...
>> trac6637@hotmail.com (Sam) writes:
>>
>>
>> You want to match "c or b followed by one or more digits", which will
>> necessarily exclude ca...
>>
>> [ab][0-9]+
>
>I think Mike meant [cb][0-9]+
>just a brain fart I'm sure since he wrote it right in the sentence right
>above.
>
>Also if your limitation is "1 character and numerals" as opposed to only c
>or b, then you can use
>/^[a-z][0-9]+$/i;
>
Oops - right you are. Thanks for catching that, Mina.
--
Mike
------------------------------
Date: Sat, 17 Nov 2001 01:36:31 GMT
From: sysop <vze33mmh@verizon.net>
Subject: Re: Extracting number from an string
Message-Id: <pan.2001.11.16.20.48.59.756169.30673@verizon.net>
On Fri, 16 Nov 2001 08:29:28 -0500, Bernard El-Hagin wrote:
> This will give you an array of all the numbers in the string if your
> definition of a number is one or more digits next to each other. You
> can't put the numbers in separate scalars unless you know ahead of time
> how many there will be. So in the second example above you could do:
>
> my ( $FirstNr, $SecNr ) = $String =~ m/(\d+)/g;
>
>
> If you knew ahead of time that there would be two matches.
You could name them independantly (not that you'd want to) this way:
my @a = $str =~ m/(\d+)/g;
foreach (@a){
${"Number".$a++} = $_;
}
------------------------------
Date: Sat, 17 Nov 2001 01:49:47 GMT
From: "Mark Shelor" <shelorm@earthlink.net>
Subject: Fast Portable Logical Shift Right in Perl ?
Message-Id: <%mjJ7.47110$hZ.4479174@newsread2.prod.itd.earthlink.net>
Crypto algorithms often require a "logical right shift" operation. Perl's
right shift operator (>>) appears to be arithmetic: i.e. the
most-significant bit (MSB) remains set after shifting to preserve sign. In
contrast, a logical right shift operation would shift a zero bit into the
MSB.
A function such as
use integer;
sub lshr { # returns $x >>> $n, where >>> means logical shift right
my $x = shift;
my $n = shift;
$x = ($x >> 1) & 0x7fffffff if ($n--);
return($x >> $n);
}
isn't portable since it assumes a 32-bit integer. Also, it doesn't seem
particularly efficient. Of course, one could do this in C, but I'm looking
for a good implementation in straight Perl.
------------------------------
Date: 16 Nov 2001 17:02:11 -0800
From: lalakaka3@hotmail.com (Christoph Bergmann)
Subject: How can I use LWP::Simple inside a safe compartment?
Message-Id: <ae9db974.0111161702.68589533@posting.google.com>
I want to use LWP::Simple inside a safe compartment created with the
Safe Module. But it ends up with errors like "Can't locate object
method "new" via package "LWP::UserAgent" at line... or "Require
trapped by operation mask..."
Here is how the code looks like (shortened ;-) ):
$codefromoutside='print wget "http://google.com";';
use LWP::Simple ();
sub wget { LWP::Simple::get $_[0] }
use Safe;
$safe=new Safe; $safe->share(qw(wget));
$safe->reval($codefromoutside);
print $@ if $@;
(There is a reason why I use "wget" instead of "get" directly because
I have already a subroutine with the name "get" elsewhere)
I tried some other things but they all didn't work. Does anybody know
how to use LWP::Simple::get inside a save compartment?
Thanks in advance,
best regards,
Christoph Bergmann
------------------------------
Date: Sat, 17 Nov 2001 00:05:10 +0100
From: "MAGiC MANiAC^mTo" <no_mto@hotmail.com>
Subject: how to create a file that doesn't exist?
Message-Id: <9t46d2$8bo$1@news.kabelfoon.nl>
how can I create a file that doesn't exist before I read the data from the
file...
open(DATA2,$db2file) or die "\"$db2file\" $!";
^^ overhere?... how?
@data2lines=<DATA2>;
close(DATA2);
can you help me?
------------------------------
Date: Fri, 16 Nov 2001 18:35:23 -0500
From: "Mina Naguib" <spam@thecouch.homeip.net>
Subject: Re: how to create a file that doesn't exist?
Message-Id: <MohJ7.136$7T.85450@wagner.videotron.net>
"MAGiC MANiAC^mTo" <no_mto@hotmail.com> wrote in message
news:9t46d2$8bo$1@news.kabelfoon.nl...
> how can I create a file that doesn't exist before I read the data from the
> file...
open (DATA2, ">>$db2file") || die "Could not open $db2file for append:
$!\n";
close (DATA2);
then do all the re-opening for reading you want.
Ps note I used >> instead of > incase the file already exists and has data
in it, the data won't be erased.
More info at perldoc -f open or
http://www.perldoc.com/perl5.6.1/pod/func/open.html
>
> open(DATA2,$db2file) or die "\"$db2file\" $!";
> ^^ overhere?... how?
> @data2lines=<DATA2>;
> close(DATA2);
>
> can you help me?
>
>
>
>
------------------------------
Date: 16 Nov 2001 15:35:30 +0000
From: Jon Ericson <Jon.Ericson@jpl.nasa.gov>
Subject: Re: how to create a file that doesn't exist?
Message-Id: <86wv0qhgot.fsf@jon_ericson.jpl.nasa.gov>
"MAGiC MANiAC^mTo" <no_mto@hotmail.com> writes:
> how can I create a file that doesn't exist before I read the data
> from the file...
Why would you do that? If the file doesn't exist, there won't be
anything in it to read. In any case, read perlopentut for information
on opening files.
Jon
--
"Consider carefully what you hear," he continued. "With the measure
you use, it will be measured to you--and even more. Whoever has
will be given more; whoever does not have, even what he has will be
taken from him." -- Mark 4:24-25 (NIV)
------------------------------
Date: Sat, 17 Nov 2001 00:24:18 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: html2txt (HTML to Text) without using lynx
Message-Id: <S6iJ7.24369$RI2.13190981@news2>
[Posted and mailed]
In article <761041e6.0111160644.7f4c462c@posting.google.com>,
anand_ramamurthy@yahoo.com (Anand Ramamurthy) writes:
> I am looking for a html2txt script
Great.
> (without using lynx).
Umm.. do you often drive screws with hammers? What's wrong with a
tool that works?
No, really. Is there a reason for "no lynx"?
> My main concern is handling tables correctly.
This is an ugly wheel to re-invent, and that's a particularly ugly brand
of wheel. Sure you won't reconsider something that already works,
is debugged, widely available, and has an interactive mode too? :)
Getting something to handle good HTML would be hard, getting something
to handle typical HTML is nigh impossible.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours *and*
clintp@geeksalad.org Perl Developer's Dictionary
"If you rush a Miracle Man, for details, see http://geeksalad.org
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Sat, 17 Nov 2001 00:40:43 GMT
From: Michael Slass <mikesl@wrq.com>
Subject: Re: html2txt (HTML to Text) without using lynx
Message-Id: <m3n11mtekc.fsf@thneed.na.wrq.com>
clintp@geeksalad.org (Clinton A. Pierce) writes:
> anand_ramamurthy@yahoo.com (Anand Ramamurthy) writes:
>> I am looking for a html2txt script
>> (without using lynx).
>
>No, really. Is there a reason for "no lynx"?
>
>> My main concern is handling tables correctly.
>
>This is an ugly wheel to re-invent
>
I agree. Perhaps the OP wants a non-interactive way to render html,
in which case lynx will work with the -dump option.
From the lynx man page:
,----
| -dump dumps the formatted output of the default document
| or one specified on the command line to standard
| output. This can be used in the following way:
|
| lynx -dump http://www.trill-home.com/lynx.html
`----
lynx does something reasonable with tables, too.
--
Mike
------------------------------
Date: Sat, 17 Nov 2001 01:48:55 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: html2txt (HTML to Text) without using lynx
Message-Id: <Pine.LNX.4.30.0111170146380.14258-100000@lxplus023.cern.ch>
On Nov 16, Anand Ramamurthy inscribed on the eternal scroll:
> My main concern is handling tables correctly.
Define "correctly".
The answer might be w3m, as long as you're willing to be limited
to either iso-8859-1 or Japanese.
But what does this really have to do with Perl?
------------------------------
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 2144
***************************************