[23587] in Perl-Users-Digest
Perl-Users Digest, Issue: 5794 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 13 14:10:50 2003
Date: Thu, 13 Nov 2003 11:10:20 -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 Thu, 13 Nov 2003 Volume: 10 Number: 5794
Today's topics:
Re: long running perl programs & memory untilization <usenet@morrow.me.uk>
Re: long running perl programs & memory untilization <stanb@panix.com>
Re: long running perl programs & memory untilization <stanb@panix.com>
Re: long running perl programs & memory untilization <usenet@morrow.me.uk>
Re: Mail::MboxParser trouble <tassilo.parseval@rwth-aachen.de>
Re: Meaning of ` signs <kaspREMOVE_CAPS@epatra.com>
Re: Meaning of ` signs (Anno Siegel)
Re: Meaning of ` signs <raisin@delete-this-trash.mts.net>
Re: Meaning of ` signs <xx087@freenet.carleton.ca>
Re: Meaning of ` signs (Anno Siegel)
Re: Need help with a program (rband)
Re: Need help with a program <xx087@freenet.carleton.ca>
Perl one-line equivalent to awk; multiple commands trig <jwngaa@att.net>
Re: Perl one-line equivalent to awk; multiple commands <grazz@pobox.com>
Re: Perl one-line equivalent to awk; multiple commands (Tad McClellan)
Re: Perl one-line equivalent to awk; multiple commands <trammell+usenet@hypersloth.invalid>
Re: problem with if-else assignment in text database <noreply@gunnar.cc>
Re: Problem with IO::Socket::INET and pop <asu1@c-o-r-n-e-l-l.edu>
Re: Problem with IO::Socket::INET and pop <usenet@morrow.me.uk>
quick one (File::Copy) <etunimi.keskinimi.takanimi@sserveri.fi>
Re: quick one (File::Copy) <tore@aursand.no>
Re: Very newbie Q anout $,@ and % (the zorg )
Wrong statement <founder@pege.org>
Re: Wrong statement <ak+usenet@freeshell.org>
Re: Wrong statement <noreply@gunnar.cc>
Re: Wrong statement <syscjm@gwu.edu>
Re: Wrong statement <xx087@freenet.carleton.ca>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 13 Nov 2003 15:38:07 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: long running perl programs & memory untilization
Message-Id: <bp08gv$46v$1@wisteria.csv.warwick.ac.uk>
Helgi Briem <HelgiBriem_1@hotmail.com> wrote:
> On Thu, 13 Nov 2003 13:19:30 +0000 (UTC), Stan Brown <stanb@panix.com>
> wrote:
>
> >If it helps my 'Native: language is C, and I just can't see anyway thet
> >these scripts should be leaking memory, based upon that experience.
> >
> >I tend to use a lot of "local" variablse in subroutines, and allmost no
> >"global" variables at all. if that impacts this discussion.
>
> Well, that probably explains most of it. 'local' in Perl is
> nothing like 'local' in C, but more like the opposite. It is
> used to change the value of a global variable for use locally.
>
> In Perl you should use 'my' to localise variables.
While this is true, it shouldn't lead to memory leaks.
The usual reason for memory leaks is that you have data structures
with circular references---the simplest case is '$x = \$x'---which can
therefore never be garbage collected. You need to break these
references when you don't need them, either by undefing the variables
concerned or by using WeakRef from CPAN.
Ben
--
Every twenty-four hours about 34k children die from the effects of poverty.
Meanwhile, the latest estimate is that 2800 people died on 9/11, so it's like
that image, that ghastly, grey-billowing, double-barrelled fall, repeated
twelve times every day. Full of children. [Iain Banks] ben@morrow.me.uk
------------------------------
Date: Thu, 13 Nov 2003 18:40:36 +0000 (UTC)
From: Stan Brown <stanb@panix.com>
Subject: Re: long running perl programs & memory untilization
Message-Id: <bp0j74$jb5$1@reader2.panix.com>
In <f337rvgt6iob81gf50tlgngk29icjt2tki@4ax.com> Helgi Briem <HelgiBriem_1@hotmail.com> writes:
>On Thu, 13 Nov 2003 13:19:30 +0000 (UTC), Stan Brown <stanb@panix.com>
>wrote:
>>If it helps my 'Native: language is C, and I just can't see anyway thet
>>these scripts should be leaking memory, based upon that experience.
>>
>>I tend to use a lot of "local" variablse in subroutines, and allmost no
>>"global" variables at all. if that impacts this discussion.
>Well, that probably explains most of it. 'local' in Perl is
>nothing like 'local' in C, but more like the opposite. It is
>used to change the value of a global variable for use locally.
>In Perl you should use 'my' to localise variables.
Sorry if I was not clear here. I am of course, using my $var; to
declare these "local" variables, in each subroutine. I was not even
aware of the "local" keyword in perl, untill now.
--
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
-- Benjamin Franklin
------------------------------
Date: Thu, 13 Nov 2003 18:43:10 +0000 (UTC)
From: Stan Brown <stanb@panix.com>
Subject: Re: long running perl programs & memory untilization
Message-Id: <bp0jbu$jb5$2@reader2.panix.com>
In <bp08gv$46v$1@wisteria.csv.warwick.ac.uk> Ben Morrow <usenet@morrow.me.uk> writes:
>Helgi Briem <HelgiBriem_1@hotmail.com> wrote:
>> On Thu, 13 Nov 2003 13:19:30 +0000 (UTC), Stan Brown <stanb@panix.com>
>> wrote:
>>
>> >If it helps my 'Native: language is C, and I just can't see anyway thet
>> >these scripts should be leaking memory, based upon that experience.
>> >
>> >I tend to use a lot of "local" variablse in subroutines, and allmost no
>> >"global" variables at all. if that impacts this discussion.
>>
>> Well, that probably explains most of it. 'local' in Perl is
>> nothing like 'local' in C, but more like the opposite. It is
>> used to change the value of a global variable for use locally.
>>
>> In Perl you should use 'my' to localise variables.
>While this is true, it shouldn't lead to memory leaks.
>The usual reason for memory leaks is that you have data structures
>with circular references---the simplest case is '$x = \$x'---which can
>therefore never be garbage collected. You need to break these
>references when you don't need them, either by undefing the variables
>concerned or by using WeakRef from CPAN.
Thanks. The latest one of these "long running" scripts to exhibit this
behavior, is really quite simple, in what it does, and has no real
complex data structures.
I suppose it would be inappropriate to post it here for criticism, right?
--
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
-- Benjamin Franklin
------------------------------
Date: Thu, 13 Nov 2003 19:01:40 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: long running perl programs & memory untilization
Message-Id: <bp0kek$a1k$3@wisteria.csv.warwick.ac.uk>
Stan Brown <stanb@panix.com> wrote:
> In <bp08gv$46v$1@wisteria.csv.warwick.ac.uk> Ben Morrow
> <usenet@morrow.me.uk> writes:
> >The usual reason for memory leaks is that you have data structures
> >with circular references---the simplest case is '$x = \$x'---which can
> >therefore never be garbage collected. You need to break these
> >references when you don't need them, either by undefing the variables
> >concerned or by using WeakRef from CPAN.
>
> Thanks. The latest one of these "long running" scripts to exhibit this
> behavior, is really quite simple, in what it does, and has no real
> complex data structures.
>
> I suppose it would be inappropriate to post it here for criticism, right?
Well, if either it's pretty short or you can cut it down to something
as short as possible that still leaks (guess which is better :), then
I'm sure noone would mind...
Ben
--
Musica Dei donum optimi, trahit homines, trahit deos. |
Musica truces molit animos, tristesque mentes erigit. | ben@morrow.me.uk
Musica vel ipsas arbores et horridas movet feras. |
------------------------------
Date: 13 Nov 2003 17:28:27 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Mail::MboxParser trouble
Message-Id: <bp0evr$fgf$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Poul Kornmod:
> Dear all,
[...]
See my follow-up in clp.modules. If you really need to post into several
groups, please do a proper crosspost. But you needn't in this case.
Issues with particular modules belong into comp.lang.perl.modules.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Thu, 13 Nov 2003 19:46:07 +0530
From: "Kasp" <kaspREMOVE_CAPS@epatra.com>
Subject: Re: Meaning of ` signs
Message-Id: <bp03r0$9oioj$1@ID-191136.news.uni-berlin.de>
> The value given to the variable $STR is given in between ` signs.
> What does this mean?
They are called backquotes. It launches the shell which fires the command
inside the backquotes.
The program waits until the command executes. And the command output (if
any) is returned....that's coming here in $STR.
HTH
--
------------------------------
Date: 13 Nov 2003 14:22:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Meaning of ` signs
Message-Id: <bp042l$t7k$1@mamenchi.zrz.TU-Berlin.DE>
Torch <rvw_torch@hotmail.com> wrote in comp.lang.perl.misc:
> Hey again all. I have progressed a great deal with the basics of perl.
> I have however a question were I do not seem to get the awnser of.
> It has to do with appointing a value to a variable. This is the last
> part of a program which I am trying to understand
>
> My question:
> The value given to the variable $STR is given in between ` signs.
> What does this mean?
> my $STR = `sqlplus -s $ORASTR >$f <<END
> SET NEWPAGE 0
> SET SPACE 0
> SET PAGESIZE 0
> SET LINESIZE 127
> SET HEADING OFF
> SET FEEDBACK OFF
> SET ECHO OFF
> SET TAB OFF
> SET COLSEP |
> $Q
> `;
>
> When I try to display the value of $STR I get nothing
>
> I am not really interested in what this variable does, I can probably
> find that out myself. I am more interested in de function of the `
> signs
In short, `` executes the enclosed text as a system command and returns
the output of that command. For details, see "perldoc perlop and look
for "qr".
In this case, the system command is an sqlplus command which gets its
input from a shell "here document". As I read it, it will only work
if the variable $Q contains "END" at this point. It's a little
inconsistent to use $Q for the closing "END" and not for the opening one,
but I may be misreading the code that isn't there.
Anno
------------------------------
Date: Thu, 13 Nov 2003 08:37:58 -0600
From: Master Web Surfer <raisin@delete-this-trash.mts.net>
Subject: Re: Meaning of ` signs
Message-Id: <MPG.1a1d5343b6f8172a9896cf@news.mts.net>
[This followup was posted to comp.lang.perl.misc]
In article <d774347.0311130604.69aa764a@posting.google.com>,
rvw_torch@hotmail.com says...
> Hey again all. I have progressed a great deal with the basics of perl.
> I have however a question were I do not seem to get the awnser of.
> It has to do with appointing a value to a variable. This is the last
> part of a program which I am trying to understand
>
> My question:
> The value given to the variable $STR is given in between ` signs.
> What does this mean?
> my $STR = `sqlplus -s $ORASTR >$f <<END
> SET NEWPAGE 0
> SET SPACE 0
> SET PAGESIZE 0
> SET LINESIZE 127
> SET HEADING OFF
> SET FEEDBACK OFF
> SET ECHO OFF
> SET TAB OFF
> SET COLSEP |
> $Q
> `;
>
> When I try to display the value of $STR I get nothing
>
> I am not really interested in what this variable does, I can probably
> find that out myself. I am more interested in de function of the `
> signs
>
> Thx alot for all your help people! It really makes a difference!
The backtick operator (`) is used to trap the output of an external
command executed by your perl script.
$output_of_program = `name_of_command parameter1 ... parameter_n`;
------------------------------
Date: 13 Nov 2003 15:18:36 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Meaning of ` signs
Message-Id: <slrnbr787m.6be.xx087@smeagol.ncf.ca>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> In short, `` executes the enclosed text as a system command and returns
> the output of that command. For details, see "perldoc perlop and look
> for "qr".
That should be, look for "qx"
--
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca
------------------------------
Date: 13 Nov 2003 15:24:42 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Meaning of ` signs
Message-Id: <bp07nq$2sl$1@mamenchi.zrz.TU-Berlin.DE>
Glenn Jackman <xx087@freenet.carleton.ca> wrote in comp.lang.perl.misc:
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > In short, `` executes the enclosed text as a system command and returns
> > the output of that command. For details, see "perldoc perlop and look
> > for "qr".
>
> That should be, look for "qx"
Right, sorry.
Anno
------------------------------
Date: 13 Nov 2003 09:24:16 -0800
From: rband@yahoo.com (rband)
Subject: Re: Need help with a program
Message-Id: <1618337a.0311130924.9046e9d@posting.google.com>
"Tintin" <me@privacy.net> wrote in message news:<bov850$1hvu10$1@ID-172104.news.uni-berlin.de>...
> "rband" <rband@yahoo.com> wrote in message
> news:1618337a.0311122208.6b653675@posting.google.com...
> > People,
> >
> > Need your help with a problem.
> > I need a program that will
> > 1. take two input files of strings, file1 and file2.
> > 2. read strings one by one from file1, and search for strings in
> > file2 that contain the string in file1 and append these to output
> > file3.
> >
> > Probably a simple problem for perl gurus, but I am a complete novice
> > ...
> > Appreciate any help ...
>
> Is this a homework question?
No, need this to solve a different problem I am working on.
------------------------------
Date: 13 Nov 2003 17:49:26 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Need help with a program
Message-Id: <slrnbr7h2h.6be.xx087@smeagol.ncf.ca>
rband <rband@yahoo.com> wrote:
> People,
>
> Need your help with a problem.
> I need a program that will
> 1. take two input files of strings, file1 and file2.
> 2. read strings one by one from file1, and search for strings in
> file2 that contain the string in file1 and append these to output
> file3.
I'd write:
open F1, $file1 or die "can't open $file1: $!\n";
open F2, $file2 or die "can't open $file2: $!\n";
open F3, '>', $file3 or die "can't open $file3 for writing: $!\n";
my @lines = <F1>;
close F1;
my $string = join '|', @lines;
my $re = qr($string);
while (<F2>) {
print F3 $_ if /$re/;
}
close F2;
close F3;
--
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca
------------------------------
Date: Thu, 13 Nov 2003 12:00:26 -0600
From: J.W. <jwngaa@att.net>
Subject: Perl one-line equivalent to awk; multiple commands triggered by a search condition
Message-Id: <mlh7rv456be80m2kbf5t61100o12bpt411@4ax.com>
In awk, I can easily do multiple commands based on a search condition:
awk '/searchtext/ {x="hello"; print x;}'
I'd like to do the same thing in a one line Perl script using the
"-ne" option.
This doesn't work:
perl -ne '{$x="hello"; print $x;} if /searchtext/'
However, "comma" seems to work. Is this the correct way to do it?
perl -ne '$x="hello" , print $x if /searchtext/'
------------------------------
Date: Thu, 13 Nov 2003 18:13:37 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Perl one-line equivalent to awk; multiple commands triggered by a search condition
Message-Id: <lRPsb.34914$y95.32413@nwrdny01.gnilink.net>
J.W. <jwngaa@att.net> wrote:
> In awk, I can easily do multiple commands based on a search condition:
> awk '/searchtext/ {x="hello"; print x;}'
> This doesn't work:
> perl -ne '{$x="hello"; print $x;} if /searchtext/'
>
> However, "comma" seems to work. Is this the correct way to do it?
> perl -ne '$x="hello" , print $x if /searchtext/'
That's fine -- but there are lots of alternatives.
% perl -ne 'do { $x = "hello"; print $x } if /searchtext/'
% perl -ne 'if (/searchtext/) { $x = "hello"; print $x }'
% perl -ne '/searchtext/ or next; $x = "hello"; print $x'
This one feels more awk-ish.
% perl -ne '/searchtext/ and do { $x = "hello"; print $x }'
--
Steve
------------------------------
Date: Thu, 13 Nov 2003 12:20:09 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl one-line equivalent to awk; multiple commands triggered by a search condition
Message-Id: <slrnbr7iqp.loa.tadmc@magna.augustmail.com>
J.W. <jwngaa@att.net> wrote:
>
> In awk, I can easily do multiple commands based on a search condition:
> awk '/searchtext/ {x="hello"; print x;}'
>
> I'd like to do the same thing in a one line Perl script using the
> "-ne" option.
A program for translating awk code into Perl code is installed
along with Perl itself:
man a2p
> This doesn't work:
> perl -ne '{$x="hello"; print $x;} if /searchtext/'
Syntax errors rarely work. :-)
You cannot use a block with the "backwards modifier" form of if.
You can use the "regular" form if you want to use a block of code:
perl -ne 'if (/searchtext/) {$x="hello"; print $x}'
> However, "comma" seems to work. Is this the correct way to do it?
Depends on what "correct" means when you say it...
Least error prone?
Easiest to read/understand/maintain?
Fastest?
...?
(BTW: _I_ would not use the comma operator like that.)
> perl -ne '$x="hello" , print $x if /searchtext/'
perl -ne 'print "hello" if /searchtext/'
is how _I_ would do it.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 13 Nov 2003 18:25:52 +0000 (UTC)
From: "John J. Trammell" <trammell+usenet@hypersloth.invalid>
Subject: Re: Perl one-line equivalent to awk; multiple commands triggered by a search condition
Message-Id: <slrnbr7j5g.m6o.trammell+usenet@hypersloth.el-swifto.com.invalid>
On Thu, 13 Nov 2003 12:00:26 -0600, J.W <jwngaa@att.net> wrote:
>
> In awk, I can easily do multiple commands based on a search condition:
> awk '/searchtext/ {x="hello"; print x;}'
>
> I'd like to do the same thing in a one line Perl script using the
> "-ne" option.
>
> This doesn't work:
> perl -ne '{$x="hello"; print $x;} if /searchtext/'
>
'Cause it's not perl. "perldoc perlsyn", look for "simple statements".
> However, "comma" seems to work. Is this the correct way to do it?
> perl -ne '$x="hello" , print $x if /searchtext/'
>
TMTOWTDI.
Other ways to do this (untested):
perl -ne 'do {$x="hello"; print $x;} if /searchtext/'
perl -ne 'if (/searchtext/) { cmd1; cmd2; ... }'
------------------------------
Date: Thu, 13 Nov 2003 16:18:52 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: problem with if-else assignment in text database
Message-Id: <bp07lc$1ilf6m$1@ID-184292.news.uni-berlin.de>
Anno Siegel wrote:
> Schlick wrote:
>> Tad McClellan wrote:
>>> To avoid becoming wearysome, simply see the Posting Guidelines
>>> that are posted here frequently...
>>
>> To become wearisome, simply quote them in every single one of
>> your messages.
>
> We're not here to entertain you, we want a workable newsgroup.
True. Nevertheless, personally I believe that the newsgroup might be
even more workable if a _link_ to the posting guidelines was appended
to each message.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 13 Nov 2003 17:23:02 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Problem with IO::Socket::INET and pop
Message-Id: <Xns94327DFB08075asu1cornelledu@132.236.56.8>
Ben Morrow <usenet@morrow.me.uk> wrote in news:bovrgs$qb3$3
@wisteria.csv.warwick.ac.uk:
>
> "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu> wrote:
>> IIRC, $@ is the relevant variable for socket errors.
>
> I don't think you do... there is nothing in perlvar or perlipc or
> IO::Socket (that I can find) that implies this. I think you may be
> thinking of
>
>| Additionally, if the "h_errno" variable is supported in C, its value
>| is returned via $? if any "gethost*()" function fails.
>
> from perlvar?
No. I am thinking of the output from the following:
#! C:/Perl/bin/perl.exe
use strict;
use warnings;
use IO::Socket::INET;
my $connection = IO::Socket::INET->new(
'LocalAddr' => 'schmocalhost',
'LocalPort' => 50000,
'Proto' => 'tcp',
'ReuseAddr' => 1,
'Blocking' => 1,
) or die "\$\!: $!\n\$\@: $@\n";
__END__
C:\temp> d.pl
$!: Invalid argument
$@: IO::Socket::INET: Bad hostname 'schmocalhost'
Now, which message is better?
Also, check out http://www.stonehenge.com/merlyn/UnixReview/col47.html:
<blockquote>
A sample socket creation looks like:
use IO::Socket::INET;
my $connection = IO::Socket::INET->new(@parameters)
or die "Cannot connect: $@";
The @parameters will be described in a moment. Note that the error comes
back in $@, not $!. (Some have argued that this is a misdesign, either on
Perl's part or on the author's part, but we're stuck with the
inconsistency either way.)
</blockquote>
Sinan.
--
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov
------------------------------
Date: Thu, 13 Nov 2003 18:53:46 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Problem with IO::Socket::INET and pop
Message-Id: <bp0jvq$a1k$1@wisteria.csv.warwick.ac.uk>
"A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu> wrote:
> <blockquote>
> A sample socket creation looks like:
>
> use IO::Socket::INET;
> my $connection = IO::Socket::INET->new(@parameters)
> or die "Cannot connect: $@";
>
> The @parameters will be described in a moment. Note that the error comes
> back in $@, not $!. (Some have argued that this is a misdesign, either on
> Perl's part or on the author's part, but we're stuck with the
> inconsistency either way.)
> </blockquote>
I didn't know about that... thank you.
Am I correct that this is not mentioned in the standard docs, or am I
simply stupid... :) ?
Ben
--
. | .
\ / The clueometer is reading zero.
. .
__ <-----@ __ ben@morrow.me.uk
------------------------------
Date: Thu, 13 Nov 2003 14:35:40 GMT
From: "Paavo P" <etunimi.keskinimi.takanimi@sserveri.fi>
Subject: quick one (File::Copy)
Message-Id: <0FMsb.2557$g4.56842@news2.nokia.com>
Are copy and move of File::Copy working recursively.
if I want to move everything from c:\work to c:\temp\sometempdir
so that there will be c:\temp\sometempdir\work ready for zipping?
------------------------------
Date: Thu, 13 Nov 2003 16:19:22 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: quick one (File::Copy)
Message-Id: <pan.2003.11.13.14.45.30.319656@aursand.no>
On Thu, 13 Nov 2003 14:35:40 +0000, Paavo P wrote:
> Are copy and move of File::Copy working recursively.
What happened when you tried it? I mean - it's a lot faster to try it out
first, than to write a message here, isn't it?
--
Tore Aursand <tore@aursand.no>
------------------------------
Date: Thu, 13 Nov 2003 14:28:06 +0000 (UTC)
From: zorg@zed.com (the zorg )
Subject: Re: Very newbie Q anout $,@ and %
Message-Id: <3fb394c6.369075773@news.btopenworld.com>
On Thu, 13 Nov 2003 13:23:08 +0100, Josef =?iso-8859-1?Q?M=F6llers?=
<josef.moellers@fujitsu-siemens.com> wrote:
>Ben Morrow wrote:
>
>> works. Now try
>> =
>
>> use strict;
>
>Point taken.
>
[ ] You know Perl
[X] You don't know Perl.
Try to read....
etc
Z
>-- =
>
>Josef M=F6llers (Pinguinpfleger bei FSC)
> If failure had no penalty success would not be a prize
> -- T. Pratchett
------------------------------
Date: Thu, 13 Nov 2003 17:24:18 +0100
From: =?Windows-1252?Q?Roland_M=F6sl?= <founder@pege.org>
Subject: Wrong statement
Message-Id: <3fb3b043$0$51112$91cee783@newsreader02.highway.telekom.at>
This statement is wrong
$display =~ s/\//\ \ \; \/\ \ \; /g;
It was in a sub routine and caused about
500 MB memory usage after 2000 calls
Why?
--
Roland Mösl
http://www.pege.org Clear targets for a confused civilization
http://web-design-suite.com Web Design starts at the search engine
------------------------------
Date: Thu, 13 Nov 2003 16:34:26 +0000 (UTC)
From: Andreas Kahari <ak+usenet@freeshell.org>
Subject: Re: Wrong statement
Message-Id: <slrnbr7ckb.dh0.ak+usenet@otaku.freeshell.org>
In article <3fb3b043$0$51112$91cee783@newsreader02.highway.telekom.at>, =?Windows-1252?Q?Roland_M=F6sl?= wrote:
> This statement is wrong
>
> $display =~ s/\//\ \ \; \/\ \ \; /g;
"Replace every occurance of '/' with ' / '".
If that was what consumed all the memory, I don't know, but I
can see that a HTML file could grow a bit if you apply this
substitution to it.
--
Andreas Kähäri
------------------------------
Date: Thu, 13 Nov 2003 17:34:56 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Wrong statement
Message-Id: <bp0c41$1j03pd$1@ID-184292.news.uni-berlin.de>
Roland Mösl wrote:
> This statement is wrong
>
> $display =~ s/\//\ \ \; \/\ \ \; /g;
>
> It was in a sub routine and caused about
>
> 500 MB memory usage after 2000 calls
>
> Why?
Don't know.
The only thing that makes it "wrong" is that it includes a few
redundant backslashes, which indicates that the author doesn't know
Perl very well. This does the same:
$display =~ s/\// \/ /g;
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 13 Nov 2003 11:49:31 -0500
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: Wrong statement
Message-Id: <3FB3B61B.1020901@gwu.edu>
Roland Mösl wrote:
> This statement is wrong
>
> $display =~ s/\//\ \ \; \/\ \ \; /g;
I'll say; most of the escapes are completely
pointless and rest can be avoided. Try this:
$display =~ s#/# / #g;
Much easier to read.
>
> It was in a sub routine and caused about
>
> 500 MB memory usage after 2000 calls
>
>
>
> Why?
>
Not knowing:
a) what $display contains,
b) how $display is declared,
c) how you decided the regex was the problem,
d) anything at all about your program except
one fairly innocuous-looking regex,
it is pretty much impossible to answer that
question.
Chris Mattern
------------------------------
Date: 13 Nov 2003 17:01:42 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Wrong statement
Message-Id: <slrnbr7e91.6be.xx087@smeagol.ncf.ca>
=?Windows-1252?Q?Roland_M=F6sl?= <founder@pege.org> wrote:
> This statement is wrong
>
> $display =~ s/\//\ \ \; \/\ \ \; /g;
>
> It was in a sub routine and caused about
>
> 500 MB memory usage after 2000 calls
How many times are you doing that substitution on the same string?
$display='~/public_html/manual';
$display =~ s{/}{ / }g for (1..3);
print "$display\n";
You might want to encode the slash in the replacement string:
$display =~ s{/}{ / }g;
--
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca
------------------------------
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 5794
***************************************