[25673] in Perl-Users-Digest
Perl-Users Digest, Issue: 7914 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 29 12:52:12 2005
Date: Tue, 29 Mar 2005 09:52: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 Tue, 29 Mar 2005 Volume: 10 Number: 7914
Today's topics:
if,then with array containing scalars <ewitkop90@hotmail.com>
Re: if,then with array containing scalars <jurgenex@hotmail.com>
Re: if,then with array containing scalars <noreply@gunnar.cc>
Re: if,then with array containing scalars <spamtrap@dot-app.org>
Re: if,then with array containing scalars <robin@infusedlight.net>
Re: if,then with array containing scalars <spamtrap@dot-app.org>
Re: if,then with array containing scalars <matternc@comcast.net>
Re: if,then with array containing scalars <spamtrap@dot-app.org>
Re: if,then with array containing scalars <jurgenex@hotmail.com>
Re: if,then with array containing scalars <see.sig@rochester.rr.com>
Re: if,then with array containing scalars <jurgenex@hotmail.com>
Re: if,then with array containing scalars <noreply@gunnar.cc>
Re: if,then with array containing scalars <noreply@gunnar.cc>
Re: if,then with array containing scalars <noreply@gunnar.cc>
Re: if,then with array containing scalars <spamtrap@dot-app.org>
Re: if,then with array containing scalars <spamtrap@dot-app.org>
Re: if,then with array containing scalars <noreply@gunnar.cc>
Re: if,then with array containing scalars <tadmc@augustmail.com>
Re: if,then with array containing scalars <tadmc@augustmail.com>
Re: if,then with array containing scalars <noreply@gunnar.cc>
input - output (nicolas-laurent)
Re: input - output <noreply@gunnar.cc>
Re: input - output <pilkowsk@informatik.uni-marburg.de>
Re: input - output <No_4@dsl.pipex.com>
Re: input - output <someone@example.com>
Re: input - output <nobull@mail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 25 Mar 2005 18:54:37 -0800
From: "erik" <ewitkop90@hotmail.com>
Subject: if,then with array containing scalars
Message-Id: <1111805677.203068.286120@g14g2000cwa.googlegroups.com>
I want to check all these scalars for the value of OK in them. The code
below does not works. Maybe I should do a foreach with $line but that
is not working either. How can I check the re OK on each element in the
array?
(this code does not work)
@final_report = ($log_action,$crc_action,$voyence_action);
if (@final_report =~ /OK/)
{
print "<body><font color=33CC33>YOU CAN CUTOVER THIS DEVICE TO
OPERATIONS</font></body>";
}
else{
print "<body><font color=FF0000>NOT OK TO CUTOVER, PLEASE FIX AND
RETEST</font></body>";
}
------------------------------
Date: Sat, 26 Mar 2005 03:12:33 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: if,then with array containing scalars
Message-Id: <Bq41e.27844$mq2.20756@trnddc08>
erik wrote:
> I want to check all these scalars for the value of OK in them. The
> code below does not works. Maybe I should do a foreach with $line but
> that is not working either. How can I check the re OK on each element
> in the array?
>
> (this code does not work)
> @final_report = ($log_action,$crc_action,$voyence_action);
> if (@final_report =~ /OK/)
Well, let's see what the documentation has to say about this construct.
"perldoc perlop" about the binding operator:
Binary "=~" binds a scalar expression to a pattern match.[...]
Well, why did you think =~ would work on an array?
Did you consider to simply grep() for your OK elements (or non-OK) elements
and just count the returned items?
If zero non-OK items, then everything must be OK, right?
jue
------------------------------
Date: Sat, 26 Mar 2005 04:11:34 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: if,then with array containing scalars
Message-Id: <3ak2f4F5rii23U1@individual.net>
erik wrote:
> I want to check all these scalars for the value of OK in them. The code
> below does not works.
And since you have warnings enabled, you already know one of the reasons
why, right?
> Maybe I should do a foreach with $line but that
> is not working either.
Why not? Did you really try hard enough?
> How can I check the re OK on each element in the
> array?
>
> (this code does not work)
> @final_report = ($log_action,$crc_action,$voyence_action);
> if (@final_report =~ /OK/)
This is one possibility:
if ( ( grep $_ eq 'OK', @final_report ) == @final_report )
See "perldoc -f grep".
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 25 Mar 2005 22:18:41 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: if,then with array containing scalars
Message-Id: <AYWdnR14htkOSdnfRVn-uQ@adelphia.com>
erik wrote:
> I want to check all these scalars for the value of OK in them. The code
> below does not works. Maybe I should do a foreach with $line but that
> is not working either. How can I check the re OK on each element in the
> array?
>
> (this code does not work)
> @final_report = ($log_action,$crc_action,$voyence_action);
> if (@final_report =~ /OK/)
You've misunderstood what a match does in list context, like you're using it
here. What it *doesn't* do is match against all the list elements - you've
already figured out that part! :-)
What it *does* do is return a list of matched subexpressions. But the regex
you're matching against above doesn't have any subexpressions. So the
returned list is empty.
For details, have a look at:
perldoc perlre
perldoc perlretut
If what you want to do is perform a given match against each item in a list,
you want to use the grep() function, like this:
if (grep(/OK/, @final_report)) {
# ... do stuff
}
For details, have a look at:
perldoc -f grep
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 25 Mar 2005 19:19:34 -0800
From: "robin" <robin@infusedlight.net>
Subject: Re: if,then with array containing scalars
Message-Id: <1111807173.977489.291550@l41g2000cwc.googlegroups.com>
the problem is that =~ does not do much with arrays.
-robin
------------------------------
Date: Fri, 25 Mar 2005 22:40:29 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: if,then with array containing scalars
Message-Id: <S9OdnTIRL5QyRNnfRVn-vw@adelphia.com>
robin wrote:
> the problem is that =~ does not do much with arrays.
A match in list context returns a list of matched values - that's a far cry
from "not much". It's quite useful, in fact, in helping to produce more
compact, readable code.
Here's an example from 'perlretut', first using a match in scalar context:
# Extract hours, minutes, seconds
$_ = '10:15:30';
my ($hours, $minutes, $seconds);
if (/(\d\d):(\d\d):(\d\d)/) {
$hours = $1;
$minutes = $2;
$seconds = $3;
}
Now, here's the same code, using an array:
$_ = '10:15:30';
my ($hours, $minutes, $seconds) =~ /(\d\d):(\d\d):(\d\d)/;
For details, have a look at:
perldoc perlretut
The whole thing is a good read, but the section titled "Extracting matches"
is particularly relevant to this particular subject.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Fri, 25 Mar 2005 22:41:03 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: if,then with array containing scalars
Message-Id: <xKSdnSsNu9RSRNnfRVn-rA@comcast.com>
erik wrote:
> I want to check all these scalars for the value of OK in them. The code
> below does not works. Maybe I should do a foreach with $line but that
> is not working either. How can I check the re OK on each element in the
> array?
perldoc -f grep
>
> (this code does not work)
> @final_report = ($log_action,$crc_action,$voyence_action);
> if (@final_report =~ /OK/)
This uses @final_report in a scalar context. You are asking if
the number "3" contains the string "OK".
> {
> print "<body><font color=33CC33>YOU CAN CUTOVER THIS DEVICE TO
> OPERATIONS</font></body>";
> }
> else{
> print "<body><font color=FF0000>NOT OK TO CUTOVER, PLEASE FIX AND
> RETEST</font></body>";
> }
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Fri, 25 Mar 2005 22:43:34 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: if,then with array containing scalars
Message-Id: <S9OdnS0RL5T6R9nfRVn-vw@adelphia.com>
Sherm Pendley wrote:
> erik wrote:
>
>> (this code does not work)
>> @final_report = ($log_action,$crc_action,$voyence_action);
>> if (@final_report =~ /OK/)
>
> If what you want to do is perform a given match against each item in a
> list, you want to use the grep() function, like this:
>
> if (grep(/OK/, @final_report)) {
D'oh! grep() returns the number of matched elements, so obviously you want
to compare that to the number of elements in @final_report:
if(grep(/OK/, @final_report) == @final_report) {
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sat, 26 Mar 2005 03:44:13 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: if,then with array containing scalars
Message-Id: <hU41e.10584$uw6.3263@trnddc06>
Gunnar Hjalmarsson wrote:
> erik wrote:
>> I want to check all these scalars for the value of OK in them. The
>> code below does not works.
>
> And since you have warnings enabled, you already know one of the
> reasons why, right?
>
>> Maybe I should do a foreach with $line but that
>> is not working either.
>
> Why not? Did you really try hard enough?
>
>> How can I check the re OK on each element in the
>> array?
>>
>> (this code does not work)
>> @final_report = ($log_action,$crc_action,$voyence_action);
>> if (@final_report =~ /OK/)
>
> This is one possibility:
>
> if ( ( grep $_ eq 'OK', @final_report ) == @final_report )
Close, but the OP explicitely asked for an RE match of 'OK' on each element,
not for equality to 'OK'.
However, because 'OK' doesn't contain any regular expression a simple
index() should work. No need to deploy the big RE gun.
jue
------------------------------
Date: Sat, 26 Mar 2005 03:46:19 GMT
From: Bob Walton <see.sig@rochester.rr.com>
Subject: Re: if,then with array containing scalars
Message-Id: <fW41e.112240$H05.34288@twister.nyroc.rr.com>
erik wrote:
> I want to check all these scalars for the value of OK in them. The code
> below does not works. Maybe I should do a foreach with $line but that
> is not working either. How can I check the re OK on each element in the
> array?
>
> (this code does not work)
> @final_report = ($log_action,$crc_action,$voyence_action);
> if (@final_report =~ /OK/)
The =~ operator accepts a scalar left-hand-side, so in this case,
it will be equivalent to:
if ('3' =~ /OK/)
as the scalar value of @final_report is the number of elements in
the array. Which won't match. You'll need to check each array
element for a match, then decide what action to take based on how
many array elements matched. See below for an example.
> {
> print "<body><font color=33CC33>YOU CAN CUTOVER THIS DEVICE TO
> OPERATIONS</font></body>";
> }
> else{
> print "<body><font color=FF0000>NOT OK TO CUTOVER, PLEASE FIX AND
> RETEST</font></body>";
> }
>
Here is maybe what you meant:
use warnings;
use strict;
#change one or more of following 3 lines to something
#not containing OK for testing
my $log_action='OK';
my $crc_action='OK';
my $voyence_action='OK';
my @final_report = ($log_action,$crc_action,$voyence_action);
my $OKcount=0;
for (@final_report){
$OKcount++ if /OK/;
}
if ($OKcount>=@final_report){ #assumes all must be OK
print "<body><font color=33CC33>YOU CAN CUTOVER THIS DEVICE
TO OPERATIONS</font></body>";
}
else{
print "<body><font color=FF0000>NOT OK TO CUTOVER, PLEASE FIX
AND RETEST</font></body>";
}
...
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Sat, 26 Mar 2005 03:49:03 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: if,then with array containing scalars
Message-Id: <PY41e.10606$uw6.3553@trnddc06>
Sherm Pendley wrote:
> robin wrote:
>
>> the problem is that =~ does not do much with arrays.
>
> A match in list context returns a list of matched values
True.
But the return value of the m operator has little to do with the left
argument of the binding operator.
jue
------------------------------
Date: Sat, 26 Mar 2005 04:50:12 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: if,then with array containing scalars
Message-Id: <3ak4odF67mu36U1@individual.net>
Sherm Pendley wrote:
> erik wrote:
>>
>> if (@final_report =~ /OK/)
>
> You've misunderstood what a match does in list context, like you're using it
> here.
True.
> What it *does* do is return a list of matched subexpressions.
No, no. I'm afraid that also you have misunderstood what it does. You
are confusing
@final_report =~ /OK/
-------------------^
with
@final_report = /OK/
Consider:
my @final_report = qw/a b c/;
print "True\n" if @final_report =~ /3/;
That outputs 'True' together with the warning "Applying pattern match
(m//) to @array will act on scalar(@array)".
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 26 Mar 2005 04:53:07 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: if,then with array containing scalars
Message-Id: <3ak4tvF69lgqjU1@individual.net>
Sherm Pendley wrote:
> robin wrote:
>> the problem is that =~ does not do much with arrays.
>
> A match in list context returns a list of matched values - that's a far cry
> from "not much".
I'd give robin more right this time. See my comments on your other post
in this thread.
> Here's an example from 'perlretut', first using a match in scalar context:
>
> # Extract hours, minutes, seconds
> $_ = '10:15:30';
> my ($hours, $minutes, $seconds);
> if (/(\d\d):(\d\d):(\d\d)/) {
> $hours = $1;
> $minutes = $2;
> $seconds = $3;
> }
>
> Now, here's the same code, using an array:
>
> $_ = '10:15:30';
> my ($hours, $minutes, $seconds) =~ /(\d\d):(\d\d):(\d\d)/;
my ($hours, $minutes, $seconds) = /(\d\d):(\d\d):(\d\d)/;
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 26 Mar 2005 05:09:28 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: if,then with array containing scalars
Message-Id: <3ak5t5F6ak1d2U1@individual.net>
Jürgen Exner wrote:
> Gunnar Hjalmarsson wrote:
>>
>> if ( ( grep $_ eq 'OK', @final_report ) == @final_report )
>
> Close, but the OP explicitely asked for an RE match of 'OK' on each element,
> not for equality to 'OK'.
Well, he said "check ... for the value of 'OK'". It's true that he used
the m// operator, but people often do so also when it's not necessary. I
simply made an assumption.
> However, because 'OK' doesn't contain any regular expression a simple
> index() should work. No need to deploy the big RE gun.
We seem to be agreed on the latter, at least. :)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 25 Mar 2005 23:17:09 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: if,then with array containing scalars
Message-Id: <wMudnfHU2f_bf9nfRVn-1A@adelphia.com>
Gunnar Hjalmarsson wrote:
> I'd give robin more right this time.
Even a blind robin catches a worm sometimes, eh? :-)
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Fri, 25 Mar 2005 23:27:44 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: if,then with array containing scalars
Message-Id: <8f-dnfUbQspfednfRVn-pg@adelphia.com>
Gunnar Hjalmarsson wrote:
> No, no. I'm afraid that also you have misunderstood what it does.
Not so much a misunderstanding as a late-night, half-asleep brain freeze.
One of those things where you look back the next day, with a clear head,
and think "WTF was I thinking? I know better than that..."
I'd better get some sleep, before I start making idiotic comparisons between
Python and Perl.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sat, 26 Mar 2005 05:39:57 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: if,then with array containing scalars
Message-Id: <3ak7mvF6aklcnU1@individual.net>
Sherm Pendley wrote:
> I'd better get some sleep, before I start making idiotic comparisons between
> Python and Perl.
On behalf of all sane readers of this group: Thanks!! :)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 25 Mar 2005 23:57:36 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: if,then with array containing scalars
Message-Id: <slrnd49ueg.1js.tadmc@magna.augustmail.com>
erik <ewitkop90@hotmail.com> wrote:
> if (@final_report =~ /OK/)
You should always enable warnings when developing Perl code!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 25 Mar 2005 23:59:56 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: if,then with array containing scalars
Message-Id: <slrnd49uis.1js.tadmc@magna.augustmail.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Sherm Pendley wrote:
>> erik wrote:
>>>
>>> if (@final_report =~ /OK/)
>>
>> You've misunderstood what a match does in list context, like you're using it
>> here.
>
> True.
False!
The pattern match above is in *scalar* context.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 26 Mar 2005 13:55:08 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: if,then with array containing scalars
Message-Id: <3al520F6co6q4U1@individual.net>
Tad McClellan wrote:
> Gunnar Hjalmarsson wrote:
>> Sherm Pendley wrote:
>>> erik wrote:
>>>>
>>>> if (@final_report =~ /OK/)
>>>
>>> You've misunderstood what a match does in list context, like
>>> you're using it here.
>>
>> True.
>
> False!
>
> The pattern match above is in *scalar* context.
Thanks for correcting my attempt at a correction. :-/
Sometimes I wish you could just delete a thread and start it all over.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 26 Mar 2005 08:58:44 -0800
From: nicolas_laurent545@hotmail.com (nicolas-laurent)
Subject: input - output
Message-Id: <97fc9ebc.0503260858.3b32c0ec@posting.google.com>
This script takes in1.txt, in2.txt in3.txt form the command line and
print this on the screen.
while (<>) {
for $a (split) {print "$a -- file $ARGV\n"}
}
result:
word -- file in1.txt
word --- file in1.txt
word -- file in2.txt
word -- file in2.txt
etc.
Question: How to generate output files for each input file that
contains the result of the script ?
out_in1.txt
word -- file in1.txt
word --- file in1.txt
out_in2.txt
word -- file in2.txt
word -- file in2.txt
Thanks
------------------------------
Date: Sat, 26 Mar 2005 17:53:57 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: input - output
Message-Id: <3alj6rF6c49ucU1@individual.net>
nicolas-laurent wrote:
> This script takes in1.txt, in2.txt in3.txt form the command line and
> print this on the screen.
>
> while (<>) {
> for $a (split) {print "$a -- file $ARGV\n"}
> }
>
> result:
> word -- file in1.txt
> word --- file in1.txt
> word -- file in2.txt
> word -- file in2.txt
> etc.
>
> Question: How to generate output files for each input file that
> contains the result of the script ?
>
> out_in1.txt
> word -- file in1.txt
> word --- file in1.txt
>
> out_in2.txt
> word -- file in2.txt
> word -- file in2.txt
What have you tried?
perldoc -f open
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 26 Mar 2005 19:26:52 +0100
From: Fabian Pilkowski <pilkowsk@informatik.uni-marburg.de>
Subject: Re: input - output
Message-Id: <3alnnaF6cqcu0U1@individual.net>
* nicolas-laurent schrieb:
>
> This script takes in1.txt, in2.txt in3.txt form the command line and
> print this on the screen.
>
> while (<>) {
> for $a (split) {print "$a -- file $ARGV\n"}
> }
>
> Question: How to generate output files for each input file that
> contains the result of the script ?
>
> out_in1.txt
> word -- file in1.txt
> word --- file in1.txt
>
> out_in2.txt
> word -- file in2.txt
> word -- file in2.txt
If you can change your suggestion about your filenames, you can use the
command line switch »-i« to edit your files in-place. E.g. after calling
your script with
$ perl -iin_* script.pl in1.txt in2.txt in3.txt
the files in1.txt, in2.txt etc contain the desired output, and the newly
created files in_in1.txt, in_in2.txt etc are backups of the input files.
If you don't need backups, supply the »-i«-switch without any extension.
Btw, the switch can be mentioned in your script's shebang line too.
If your filenames matter, try to open and write your files manually.
regards,
fabian
------------------------------
Date: Sat, 26 Mar 2005 18:31:37 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: input - output
Message-Id: <XoudnXzrcJUaN9jfRVnytw@pipex.net>
nicolas-laurent wrote:
> Question: How to generate output files for each input file that
> contains the result of the script ?
Basic code is:
while (<>) {
if ($. == 1) {
print $ARGV, "\n";
}
for $a (split) {print "$a -- file $ARGV\n"}
close ARGV if (eof);
}
Look up open and eof (in perlfunc) and ARGV (in perlvar) for why.
--
Just because I've written it doesn't mean that
either you or I have to believe it.
------------------------------
Date: Sat, 26 Mar 2005 19:47:13 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: input - output
Message-Id: <5%i1e.109839$fc4.69383@edtnps89>
nicolas-laurent wrote:
> This script takes in1.txt, in2.txt in3.txt form the command line and
> print this on the screen.
>
> while (<>) {
> for $a (split) {print "$a -- file $ARGV\n"}
> }
>
> result:
> word -- file in1.txt
> word --- file in1.txt
> word -- file in2.txt
> word -- file in2.txt
> etc.
>
>
> Question: How to generate output files for each input file that
> contains the result of the script ?
>
> out_in1.txt
> word -- file in1.txt
> word --- file in1.txt
>
> out_in2.txt
> word -- file in2.txt
> word -- file in2.txt
while ( <> ) {
open OUT, ">out_$ARGV" and select OUT if 1..1;
print "$_ -- file $ARGV\n" for split;
}
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sun, 27 Mar 2005 09:27:05 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: input - output
Message-Id: <d25tub$han$1@sun3.bham.ac.uk>
In an excellent answer Fabian Pilkowski wrote:
> If you can change your suggestion about your filenames, you can use the
> command line switch »-i« to edit your files in-place. E.g. after calling
> your script with
>
> $ perl -iin_* script.pl in1.txt in2.txt in3.txt
>
> the files in1.txt, in2.txt etc contain the desired output, and the newly
> created files in_in1.txt, in_in2.txt etc are backups of the input files.
Actually they are not newly created, they are the original files renamed.
------------------------------
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 7914
***************************************