[29782] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1025 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 12 00:10:10 2007

Date: Sun, 11 Nov 2007 21:09:04 -0800 (PST)
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, 11 Nov 2007     Volume: 11 Number: 1025

Today's topics:
    Re: &Compress::Zlib::gzopen and Scalar::Util errors  kereml@sibernet.com.tr
    Re: Convert some files from html to plaintext <lucavilla@cashette.com>
    Re: Convert some files from html to plaintext <jurgenex@hotmail.com>
    Re: Convert some files from html to plaintext <lucavilla@cashette.com>
    Re: Convert some files from html to plaintext <elvis-85473@notatla.org.uk>
    Re: How to convert csv file to XML using XML::Simple? sln@netherlands.co
    Re: How to convert csv file to XML using XML::Simple? sln@netherlands.co
    Re: launch a DOS program from a Perl script? <lucavilla@cashette.com>
    Re: launch a DOS program from a Perl script? <jurgenex@hotmail.com>
    Re: launch a DOS program from a Perl script? <veatchla@yahoo.com>
    Re: launch a DOS program from a Perl script? <lucavilla@cashette.com>
    Re: launch a DOS program from a Perl script? (Doug Miller)
    Re: Perl newbie regular expression usage question/help <tadmc@seesig.invalid>
    Re: process growing without limit <ben@morrow.me.uk>
    Re: sleep/fork/shell/SIGCHLD interaction problem <m@rtij.nl.invlalid>
    Re: sleep/fork/shell/SIGCHLD interaction problem <ben@morrow.me.uk>
    Re: sleep/fork/shell/SIGCHLD interaction problem xhoster@gmail.com
    Re: To extract numbers from files with Perl <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 11 Nov 2007 19:47:12 -0800
From:  kereml@sibernet.com.tr
Subject: Re: &Compress::Zlib::gzopen and Scalar::Util errors
Message-Id: <1194839232.316737.272590@50g2000hsm.googlegroups.com>

On 8 Kas m, 01:17, "Thrill5" <nos...@somewhere.com> wrote:
> I would suggest backing out the security update to get your production
> system up and running and then testing your applications on another machi=
ne
> to figure out what you need to do to get your apps working with the secur=
ity
> update.
>
> "Tim Boyer" <t...@denmantire.com> wrote in message
>
> news:ti12j3pbf5cv48a6rd12a42lv3ji3km0j2@4ax.com...
>
>
>
> > I'm running Red Hat Enterprise version 5 in a mixture of 32 and 64 bit
> > environments.  There was a Perl security update last night, updating pe=
rl
> > 5.8.8-10. to 5.8.8-10_02.
>
> > Since then, I've been having problems running a number of perl
> > applications.
> > For instance, SpamAssassin:
>
> > [root@roosevelt scripts]# spamassassin --lint
> > Use of uninitialized value in concatenation (.) or string at
> > /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/Scalar/Util.pm line 30.
> > Use of uninitialized value in concatenation (.) or string at
> > /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/Scalar/Util.pm line 30.
>
> > or CPAN:
>
> > cpan> install Bundle::CPAN
> > CPAN: Storable loaded ok
> > Going to read /root/.cpan/Metadata
> >  Database was generated on Sun, 19 Aug 2007 04:36:49 GMT
> > CPAN: LWP::UserAgent loaded ok
> > Fetching with LWP:
> >  http://mirror.hyperian.net/CPAN/authors/01mailrc.txt.gz
> > Use of uninitialized value in concatenation (.) or string at
> > /usr/lib/perl5/5.8.8/i386-linux-thread-multi/Scalar/Util.pm line 30.
> > Going to read /root/.cpan/sources/authors/01mailrc.txt.gz
> > Undefined subroutine &Compress::Zlib::gzopen called at
> > /usr/lib/perl5/5.8.8/CPAN.pm line 5721.
>
> > I've ?fixed? the Scalar::Util problem by doing a force install
> > Scalar::Util.
> > I've tried to do the same with Compress::Zlib, but with less luck:
>
> > cpan> install Compress::Zlib
> > Running install for module Compress::Zlib
> > Running make for P/PM/PMQS/Compress-Zlib-2.007.tar.gz
> > Undefined subroutine &Compress::Zlib::gzopen called at
> > /usr/lib/perl5/5.8.8/CPAN.pm line 5721.
>
> > So apparently I can't install Compress::Zlib until I get Compress::Zlib
> > working.  This is... a conundrum.
>
> > Pointers in the right direction greatly appreciated.
>
> > --
> > tim boyer
> > t...@denmantire.com- Al nt y  gizle -
>
> - Al nt y  g=F6ster -

Hi,

Try to upgrade CPAN

#perl -MCPAN -e shell
> install Bundle::CPAN

it solved my problem.



------------------------------

Date: Sun, 11 Nov 2007 11:45:08 -0800
From:  Luca Villa <lucavilla@cashette.com>
Subject: Re: Convert some files from html to plaintext
Message-Id: <1194810308.381050.246390@v2g2000hsf.googlegroups.com>

> e.g. by redirecting the
> output of lynx to that file or buy writing to that file or ...

Isn't there an equivalent of the Lynx rendering engine for Perl?
I know that "Lynx -dump" does a good conversion but I fear that
calling an external program thousand of times is a waste of
resources...



------------------------------

Date: Sun, 11 Nov 2007 19:55:58 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Convert some files from html to plaintext
Message-Id: <i7JZi.4106$cD.1341@trndny08>

Luca Villa wrote:
>> e.g. by redirecting the
>> output of lynx to that file or buy writing to that file or ...
>
> Isn't there an equivalent of the Lynx rendering engine for Perl?

Why would Perl do HTML rendering? Anyway, which part of "perldoc -q HTML"

     How do I remove HTML from a string?

don't you understand?

jue 




------------------------------

Date: Sun, 11 Nov 2007 12:02:54 -0800
From:  Luca Villa <lucavilla@cashette.com>
Subject: Re: Convert some files from html to plaintext
Message-Id: <1194811374.916496.63040@k79g2000hse.googlegroups.com>

J=FCrgen Exner

the problem is that converting html to a good equivalent in plain text
is not a simple operation of "removing HTML from a string".

Think for example to an html table, with columns of different width
etc...
Textual browsers like Lynx, Links, Elinks, W3M do a good job in
presenting html tables in plain text. I'm searching for something of
this quality...



------------------------------

Date: 12 Nov 2007 01:36:11 GMT
From: all mail refused <elvis-85473@notatla.org.uk>
Subject: Re: Convert some files from html to plaintext
Message-Id: <slrnfjfb89.f2l.elvis-85473@notatla.org.uk>

On 2007-11-11, Luca Villa <lucavilla@cashette.com> wrote:
>> e.g. by redirecting the
>> output of lynx to that file or buy writing to that file or ...
>
> Isn't there an equivalent of the Lynx rendering engine for Perl?
> I know that "Lynx -dump" does a good conversion but I fear that
> calling an external program thousand of times is a waste of
> resources...

But not a waste of your time - use "lynx -dump" and develop
your laziness more fully.

-- 
Elvis Notargiacomo  master AT barefaced DOT cheek
http://www.notatla.org.uk/goen/


------------------------------

Date: Sun, 11 Nov 2007 19:11:49 -0800
From: sln@netherlands.co
Subject: Re: How to convert csv file to XML using XML::Simple?
Message-Id: <s1hfj393ggm2rk9lpth07l8ui1bjlj2s7k@4ax.com>

On Sat, 03 Nov 2007 07:58:20 -0700, Paul Lalli <mritty@gmail.com> wrote:

>On Nov 3, 9:58 am, James Egan <jegan...@comcast.net> wrote:
>> On Fri, 02 Nov 2007 03:55:11 -0700, Paul Lalli wrote:
>> > print XMLout($xml,  RootName => "ADDRESS_BOOK", NoAttr => 1);
>> > __DATA__
>> > Robert, Smith, 123 Main St.
>> > Jane, Smith, 456 Market St.
>> > William, Watson, 789 First Ave
>>
>> > Paul Lalli
>>
>> Thanks.  I found a really great module named XML::Generator.
>> Most modules like XML::Writer and XML::Simple use a .xml file for
>> input, and then output XML.
>
>You're making no sense.  XML::Simple, as I demonstrated above, does
>not take *any* file for input.  It takes a reference to a hash
>structure, and then outputs XML.
>
>Why are you bothering to thank me when you obviously didn't read my
>post?
>
>Paul Lalli
Why would anybody want to thank you? You know absolutely nothing
about XML





------------------------------

Date: Sun, 11 Nov 2007 19:13:43 -0800
From: sln@netherlands.co
Subject: Re: How to convert csv file to XML using XML::Simple?
Message-Id: <d5hfj3tremmgale5e0aqtdm3r17ri7eicd@4ax.com>

On Fri, 02 Nov 2007 11:42:10 GMT, Tad McClellan <tadmc@seesig.invalid> wrote:

>James Egan <jegan472@comcast.net> wrote:
>
>> Robert, Smith, 123 Main St.
>> Jane, Smith, 456 Market St.
>> William, Watson, 789 First Ave.
>>
>>
>> How would I convert that to an XML file like this:
>>
>><?xml version="1.0" ?>
>><ADDRESSBOOK>
>>  <CONTACT>
>>     <FIRST_NAME> Robert  </FIRST_NAME>
>>     <LAST_NAME> Smith </LAST_NAME>
>>     <ADDRESS> 123 Main St. </ADDRESS>
>>  </CONTACT>
>>  <CONTACT>
>>     <FIRST_NAME> Jane  </FIRST_NAME>
>>     <LAST_NAME> Smith </LAST_NAME>
>>     <ADDRESS> 456 Market St. </ADDRESS>
>>  </CONTACT>
>>  <CONTACT>
>>     <FIRST_NAME> William  </FIRST_NAME>
>>     <LAST_NAME> Watson </LAST_NAME>
>>     <ADDRESS> 789 First Ave. </ADDRESS>
>>  </CONTACT>
>></ADDRESSBOOK>
>
>
>--------------------------
>#!/usr/bin/perl
>use warnings;
>use strict;
>
>while ( <DATA> ) {
>    chomp;
>    my($first, $last, $adr) = split /,\s*/;
>    print <<ENDCONTACT;
>  <CONTACT>
>    <FIRST_NAME>$first</<FIRST_NAME>
>    <LAST_NAME>$last</LAST_NAME>
>    <ADDRESS>$adr</ADDRESS>
>  </CONTACT>
>ENDCONTACT
>};
>
>
>__DATA__
>Robert, Smith, 123 Main St.
>Jane, Smith, 456 Market St.
>William, Watson, 789 First Ave.
>--------------------------
You can't write xml this way can you????
No, I didn't think so.


------------------------------

Date: Sun, 11 Nov 2007 11:26:45 -0800
From:  Luca Villa <lucavilla@cashette.com>
Subject: Re: launch a DOS program from a Perl script?
Message-Id: <1194809205.508627.240950@o38g2000hse.googlegroups.com>

The solution was:
perl -e "system qq'HTML2TXT $_ > '.(/(.*)html/)[0].'txt' for <c:/dir/*-
red.html>"



------------------------------

Date: Sun, 11 Nov 2007 19:57:34 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: launch a DOS program from a Perl script?
Message-Id: <O8JZi.2512$ET.1226@trndny03>

Ron Bergin wrote:
> On Nov 11, 8:22 am, "Jürgen Exner" <jurge...@hotmail.com> wrote:
>> t.pl had compilation errors.
>> <\quote>
>> You may want to fix that first.
>>
>> jue
>
> It might help if you type in the command correctly when testing.
>
> <c:/>dir/*-red.html>
>
> is not the same as
>
> <c:/dir/*-red.html>

Indeed. Copy-and-paste error of the oversized line.
My mistake.

jue 




------------------------------

Date: Sun, 11 Nov 2007 14:37:03 -0600
From: l v <veatchla@yahoo.com>
Subject: Re: launch a DOS program from a Perl script?
Message-Id: <13jepvgj0tcbr93@news.supernews.com>

Luca Villa wrote:
> Can I launch a DOS program from within a Perl script?
> 
> ____
> 
> This is what I need to do:
> 
> I have many files like this:
> c:\dir\pippo-red.html
> c:\dir\paperino-yellow.html
> c:\dir\pluto-red.html
> c:\dir\gastone-green.html
> 
> I have a HTML2TXT.EXE program that converts files from html to txt
> (removing the tags etc...).
> 
> The syntax of this program is: "HTML2TXT htmlfilename.htm >
> txtfilename.txt"
> 
> I want to convert all and only the file which path-name match "c:\dir
> \*-red.html". The output files must have the suffix "-text" in the
> filename and ".txt" as extension.
> 
> In a few words the Perl script in this example must execute the
> command two times like this:
> HTML2TXT c:\dir\pippo-red.html > c:\dir\pippo-red-text.txt
> HTML2TXT c:\dir\pluto-red.html > c:\dir\pluto-red-text.txt
> 
> 
> Do you know how can I do this?
> 
> 
> Thanks in advance for any help
> 

Do you need to use Perl?  Use plain old DOS?

for %F in (c:\dir\*-red.html) do HTML2TXT "%F" > "%~dF%~pF%~nF.txt"

execute for /? for information.

-- 

Len


------------------------------

Date: Sun, 11 Nov 2007 14:27:49 -0800
From:  Luca Villa <lucavilla@cashette.com>
Subject: Re: launch a DOS program from a Perl script?
Message-Id: <1194820069.976992.246250@o38g2000hse.googlegroups.com>


> Do you need to use Perl?  Use plain old DOS?
>
> for %F in (c:\dir\*-red.html) do HTML2TXT "%F" > "%~dF%~pF%~nF.txt"

Genial!

I'm very happy that there is still someone on this earth that master
DOS/BATCH commands.

Thank you VERY VERY much Len! I'll use your solution!

"for /?" revealed an hidden treasure

BTW are there any active communities/forums/message boards on the web
to discuss DOS/BATCH commands?



------------------------------

Date: Mon, 12 Nov 2007 01:11:13 GMT
From: spambait@milmac.com (Doug Miller)
Subject: Re: launch a DOS program from a Perl script?
Message-Id: <RKNZi.68184$YL5.44665@newssvr29.news.prodigy.net>

In article <1194820069.976992.246250@o38g2000hse.googlegroups.com>, Luca Villa <lucavilla@cashette.com> wrote:
>
>> Do you need to use Perl?  Use plain old DOS?
>>
>> for %F in (c:\dir\*-red.html) do HTML2TXT "%F" > "%~dF%~pF%~nF.txt"
>
>Genial!
>
>I'm very happy that there is still someone on this earth that master
>DOS/BATCH commands.
>
>Thank you VERY VERY much Len! I'll use your solution!
>
>"for /?" revealed an hidden treasure
>
>BTW are there any active communities/forums/message boards on the web
>to discuss DOS/BATCH commands?
>
alt.msdos.batch
alt.msdos.batch.nt

-- 
Regards,
        Doug Miller (alphageek at milmac dot com)

It's time to throw all their damned tea in the harbor again.


------------------------------

Date: Mon, 12 Nov 2007 01:39:46 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Perl newbie regular expression usage question/help
Message-Id: <slrnfjf9v0.np5.tadmc@tadmc30.sbcglobal.net>

dfairman16@hotmail.com <dfairman16@hotmail.com> wrote:
> On Nov 11, 5:18 pm, Tad McClellan <ta...@seesig.invalid> wrote:
>> dfairma...@hotmail.com <dfairma...@hotmail.com> wrote:
>> > the token I want is "FRED (" and including the
>> > spaces. This is my big problem, spaces everythere except for between
>> > quotes should be treated as just white space, in quotes they are not.
>>
>> Now you have a Question that is Asked Frequently:
>>
>>    How can I split a [character] delimited string except when
>>    inside [character]?
>>
>> --
>> Tad McClellan
>> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


[ it is poor netiquette to quote .sigs ]


> OK, the link is
>
> http://www.perl.com/doc/FAQs/FAQ/oldfaq-html/Q4.28.html

> 2. I mentioned out the outset I'm learning <g>


You do not need a link.

The Perl FAQ is installed on your own hard disk as part of
a normal perl install.

The docs (including the FAQ) installed with your perl will be 
better than what you can find on the web, because it will be
specific to the version of perl that you are actually using.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Sun, 11 Nov 2007 20:50:41 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: process growing without limit
Message-Id: <1i6k05-3rp.ln1@osiris.mauzo.dyndns.org>


Quoth Yakov <iler.ml@gmail.com>:
> I have a perl daemon that grows without limit. The code is large and
> written by different people.
> 
> I believe that some hash or array grows without limit there. I don't
> think there are cyclic refs anywhere in the code. I'd like to use some
> tool to catch it.
> 
> It would help me it I had a function FindLargeHashOrArray($N) which
> would go over *all* hashes and arrays in *all* modules, and show me
> hashes and arrays which have more than $N elements.

You may have some luck with Devel::Leak or Devel::Cycle.

Ben



------------------------------

Date: Sun, 11 Nov 2007 21:40:37 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: sleep/fork/shell/SIGCHLD interaction problem
Message-Id: <pan.2007.11.11.20.37.49@rtij.nl.invlalid>

On Sun, 11 Nov 2007 15:41:34 +0000, Justin Fletcher wrote:

> The problem is that if I press ctrl-Z whilst the program is sleeping,
> and then resume it in the background with 'bg', a SIGCHLD is triggered.
> The handler then does a 'wait' to get the PID and hangs because there
> isn't a child that's exited. We never leave the SIGCHLD handler (unless
> the long running task completes). The use of 'tail -f /dev/null' is
> purely to simulate a task which just keeps running.
 
 
> I believe this sort of construct to be normal and even recommended from
> the perlipc pages; so... am I doing something wrong ? is bash ? is the
> kernel ? is perl ?
> 
> I'm hoping I'm just misunderstanding how process control should be done.

It seems you are getting signals for the stop and start of the child, see 
man sigaction and look at the possible CHLD signals.

This is worrying, your code is quite a normal construct and there must be 
a lot of production code out there that has this same problem.

Additionally I could not find out how to get at the si_code for the 
signal.

The solution seems to me to use (thanks to perldoc perlipc):

#!/usr/bin/perl

use strict;
use warnings;
use POSIX ":sys_wait_h";

sub REAPER {
  print "entering reaper\n";
    my $child;
    # If a second child dies while in the signal handler caused by the
    # first death, we won’t get another signal. So must loop here else
    # we will leave the unreaped child as a zombie. And the next time
    # two children die we get another zombie. And so on.

    # Also, we can get signals on stopping and continuation of children
    # so there is no process to wait on

    while (($child = waitpid(-1,WNOHANG)) > 0) {
	print "Reaped $child: $?\n";
    }
    $SIG{CHLD} = \&REAPER;  # still loathe sysV
  print "Leaving reaper\n";
}
$SIG{CHLD} = \&REAPER;

my $pid;
print "Forking to do some long running task\n";
unless ($pid = fork) {
  $SIG{'CHLD'} = 'DEFAULT';
  my $i=0;
  while (1) {
    print $i++, "\n";
    sleep 1;
  }
}

print "pid=$pid\n";
print "Sleeping\n";
sleep 20;
print "Waking\n";
kill 'INT', $pid;
sleep 2;



------------------------------

Date: Mon, 12 Nov 2007 00:21:05 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: sleep/fork/shell/SIGCHLD interaction problem
Message-Id: <hsik05-naq.ln1@osiris.mauzo.dyndns.org>


Quoth Justin Fletcher <gerph@gerph.org>:
> 
> The problem is that if I press ctrl-Z whilst the program is sleeping, and 
> then resume it in the background with 'bg', a SIGCHLD is triggered.

This is expected bahaviour if your signal handler is installed with
sigaction without specifying the SA_NOCLDSTOP flag, which is what perl
does. See your system's sigaction(2).

> The handler then does a 'wait' to get the PID and hangs because there
> isn't a child that's exited.

You shouldn't simply call wait in a SIGCHLD handler, anyway. You don't
know how many children have exitted before you could handle the signal.
The usual idiom is something like

    use POSIX qw/:sys_wait_h/;

    $SIG{CHLD} = sub { 1 while 0 < waitpid -1, WNOHANG };

which will wait for everything that needs waiting for. See perlipc for
examples which let you get the child pid and exit status, and waitpid(2)
for how to check for children that have stopped/continued.

> In the shell, the following sequence is seen:
> 
> ----
> justin@buttercup:~/Root/perltest$ perl testsleep.pl
> Forking to do some long running task
> Sleeping
> 
> [1]+  Stopped                 perl testsleep.pl

How do you think the shell knew its child had stopped? It relies on
SIGCHLD being sent when the process's status changes.

Ben



------------------------------

Date: 12 Nov 2007 03:30:18 GMT
From: xhoster@gmail.com
Subject: Re: sleep/fork/shell/SIGCHLD interaction problem
Message-Id: <20071111223021.553$Y4@newsreader.com>

Justin Fletcher <gerph@gerph.org> wrote:
> Hiya,
>
> I'm having a problem trying to get a simple program to respond the way
> that I expect. The basic premise is thus :
>
> 1. Fork a child.
> 2. Sleep for a while.
> 3. Do other stuff.
>
> This seems pretty simple, and I have a SIGCHLD handler which will catch
> my forked process if it exits. I thought everything was fine. Then I
> found that is I press ctrl-Z to suspend the parent whilst I'm running the
> program and then background it, it hangs.

I find that this only occurs if I hit ctrl-Z from the keyboard.  If I
send the process the TSTP signal via some other means, it doesn't happen.
I know that shells often respond to ctrl-Z, ctrl-C, etc, by sending signals
to entire process groups, rather than just the main process.  I don't
exactly how this leads to the observed phenomena, though.

Also, be using "strace", I see that the process actually is getting a
SIGCHLD, (as opposed to some bug in Perl causing it to think that it did
when really it didn't)

<snip. Thank you for providing the sample code.  But I don't think I need
to quote it.>


> I believe this sort of construct to be normal and even recommended from
> the perlipc pages; so... am I doing something wrong ? is bash ? is the
> kernel ? is perl ?

I see the same or similar behavior under tcsh.  So I'm thinking it is the
kernel.  I often find that programs which spawn other program do not behave
well when put into the background after the fact, but yours is the only
simple demonstration of this that I've seen.  When using programs that fork
or spawn others, I've learned to try to start such programs in the
background with &, and if I forget then I just kill them and restart them
in the background rather than using ctrl-Z

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


------------------------------

Date: Mon, 12 Nov 2007 01:39:46 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: To extract numbers from files with Perl
Message-Id: <slrnfjfbio.np5.tadmc@tadmc30.sbcglobal.net>

Luca Villa <lucavilla@cashette.com> wrote:
> quasi-solution:
>
> {local @ARGV=<c:/input/*-home.html>; local $^I='.extract.txt'; local $
                                             ^^^
                                             ^^^
That turns on inplace editing.


> \=$/;
> while( <> ){
>     print join'|',/([\d.]+)/g if /\d/
> }
> }
>
> This is still not the solution because it puts the new file in pumico-
> home.html and the old file in pumico-home.html.extract.txt


That's what inplace editing is supposed to do.

If that is not what you wanted done, then you should not have
turned on inplace editing, in which case, you would have to
handle the file naming in your own code.


# untested
foreach my $fname ( glob 'c:/input/*-home.html' ) {
    (my $outname = $fname) =~ s/\.html$/-extract.txt/;
    open my $extract, '>', $outname or die "could not open '$outname' $!";

    local @ARGV = $fname;
    local $\ = $/;
    while( <> ){
        next unless /\d/;
        print {$extract} join( '|', /([\d.]+)/g );
    }

    close $extract;
}


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

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 V11 Issue 1025
***************************************


home help back first fref pref prev next nref lref last post