[28134] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9498 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 19 09:05:58 2006

Date: Wed, 19 Jul 2006 06:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 19 Jul 2006     Volume: 10 Number: 9498

Today's topics:
    Re: "Its fast as heck" shiriram krishnamurthi said sche <rvtol+news@isolution.nl>
    Re: Hashes of hashes? <zen13097@zen.co.uk>
    Re: Help with tied/nested data structures <mumia.w.18.spam+nospam.usenet@earthlink.net>
    Re: Help with tied/nested data structures anno4000@radom.zrz.tu-berlin.de
        hostname <-> ip address <call.anirban@gmail.com>
    Re: hostname <-> ip address anno4000@radom.zrz.tu-berlin.de
    Re: hostname <-> ip address <call.anirban@gmail.com>
        how to extract multi-line text perltcl@yahoo.com
    Re: how to extract multi-line text <1usa@llenroc.ude.invalid>
    Re: how to extract multi-line text <abhisawa@gmail.com>
    Re: Net::Telnet - Library Application <laff7430@bellsouth.net>
    Re: Net::Telnet - Library Application <laff7430@bellsouth.net>
    Re: please urgent <bik.mido@tiscalinet.it>
    Re: Premature end of script headers: mail.cgi <tadmc@augustmail.com>
    Re: Premature end of script headers: mail.cgi usenet@DavidFilmer.com
    Re: What is a type error? <marshall.spight@gmail.com>
    Re: why is  perl -e 'unlink(glob("*"))' so much faster  <joe@inwap.com>
    Re: why is  perl -e 'unlink(glob("*"))' so much faster  <joe@inwap.com>
    Re: why is  perl -e 'unlink(glob("*"))' so much faster  <rvtol+news@isolution.nl>
    Re: why is perl -e 'unlink(glob("*"))' so much faster t <joe@inwap.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 19 Jul 2006 03:35:21 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: "Its fast as heck" shiriram krishnamurthi said scheme webserver 8-10x spped of apachemodeperl
Message-Id: <e9k9b3.qg.1@news.isolution.nl>

gavino schreef:

> "Its fast as heck" shiriram krishnamurthi said scheme webserver 8-10x
> spped of apachemodeperl
> Was he serious?  he said 8x as fast as apache for dynamic content but
> then someone from audioence asked about apache mod perl and he said
> yes quickly.
> Can scheme kick that much butt? (as he says)
> 7:26 on this mpg "its fast as heck"
> http://technetcast.ddj.com/tnc_play_stream.html?stream_id=644

PHP can be fast too:
http://talks.php.net/show/apeu06

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: 19 Jul 2006 07:41:30 GMT
From: Dave Weaver <zen13097@zen.co.uk>
Subject: Re: Hashes of hashes?
Message-Id: <44bde22a$0$10954$fa0fcedb@news.zen.co.uk>

On 18 Jul 2006 08:04:56 -0700, asincero <asincero@gmail.com> wrote:
>  I have this:
> 
>  use strict;
>  my %my_hash = ();
> 
>  $my_hash{'1'}{'a'} = "Hello";
>  $my_hash{'1'}{'b'} = "world!";
>  $my_hash{'2'}{'c'} = "Foo";
>  $my_hash{'2'}{'d'} = "bar";
> 

Others have already answered your question, but as an observation, if
you're populating a hash with static data, you may find it more
readable to lay your code out something like this:

    my %my_hash = (
	1 => {
	    a => 'Hello',
	    b => 'world!',
	},
	2 => {
	    c => 'Foo',
	    d => 'bar',
	},
    );

which has the same effect as your code above.


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

Date: Wed, 19 Jul 2006 11:56:24 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: Help with tied/nested data structures
Message-Id: <I5pvg.275$gF6.238@newsread2.news.pas.earthlink.net>

On 07/18/2006 07:50 PM, Clint Olsen wrote:
> Hi:
> 
> I have a script included in the post that behaves strangely.  Originally I
> had a plain hash that had a few scalars inside of it that were tied.
> However, for reasons I won't bore you with here, I needed to also tie the
> containing hash.  However, once I did this, I broke the tied scalars.
> After I tie the scalar, it nearly gets immediately culled by the Perl
> garbage collector (DESTROY is called), 
> [...]
> package main;
> 
> my %hash;
> 
> tie %hash, 'Foo';
> 
> tie $hash{bar}, 'Bar', 'blah';
> 
> $hash{booga} = 'baz';
> 
> print "Tied scalar value is $hash{bar}\n";

One part of the problem is that you're not saving the values 
returned by tie. Those values are the object references that 
underly the tied hashes and scalars. Since the ref counts for 
those objects is zero right after you've created them, the GC 
cleans them up almost immediately, so save the values:

my $object1 = tie %hash, 'Foo';

my $object2 = tie $hash{bar}, 'Bar', 'blah';


HTH



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

Date: 19 Jul 2006 13:00:34 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Help with tied/nested data structures
Message-Id: <4i6oniF2eh6pU1@news.dfncis.de>

Mumia W. <mumia.w.18.spam+nospam.usenet@earthlink.net> wrote in comp.lang.perl.misc:
> On 07/18/2006 07:50 PM, Clint Olsen wrote:
> > Hi:
> > 
> > I have a script included in the post that behaves strangely.  Originally I
> > had a plain hash that had a few scalars inside of it that were tied.
> > However, for reasons I won't bore you with here, I needed to also tie the
> > containing hash.  However, once I did this, I broke the tied scalars.
> > After I tie the scalar, it nearly gets immediately culled by the Perl
> > garbage collector (DESTROY is called), 
> > [...]
> > package main;
> > 
> > my %hash;
> > 
> > tie %hash, 'Foo';
> > 
> > tie $hash{bar}, 'Bar', 'blah';
> > 
> > $hash{booga} = 'baz';
> > 
> > print "Tied scalar value is $hash{bar}\n";
> 
> One part of the problem is that you're not saving the values 
> returned by tie.

That is normally not necessary.

> Those values are the object references that 
> underly the tied hashes and scalars. Since the ref counts for 
> those objects is zero right after you've created them, the GC 
> cleans them up almost immediately, so save the values:

No.  Normally the object is stored in the magic structure that is
attached to the tied variable, refcounted and all.  As long as that
magic survives, the object survives.  The question is why it doesn't
in this case.

Actually another question needs to be asked first.  What are the
expected semantics of

    tie $hash{ key}, 'TieScalar';

when %hash itself it tied.  Scalar tie() only works on actual scalar
variables (SVs), but there is no such thing associated with $hash{ key}
with a tied hash.  So there really is no place to attach the scalar tie
magic to.  Perl should probably warn about that.  At the moment it
appears to silently drop it, as witnessed by the early call to DESTROY.

If you want to tie the values of a tied hash, you'd have to look into
the hash-tying mechanism itself.  If there is a definite scalar for
every key where the value is stored, you'd have to tie that.  If there
is no such scalar, you're out of luck.

Then again, it seems to me that anything you could to in an additional
scalar tie of the value you could also to in the hash-tie in the first
place.

Anno


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

Date: 19 Jul 2006 02:52:27 -0700
From: "Ani" <call.anirban@gmail.com>
Subject: hostname <-> ip address
Message-Id: <1153302747.689110.239580@p79g2000cwp.googlegroups.com>

Hi All,
If I use the following script to get ip address if i supply a hostname
& vice-versa:
---------------------------------------------------------------------------
#!/usr/bin/perl

use strict;
use warnings;

use Socket qw(AF_INET);

usage() if $#ARGV == -1;
display_info( @ARGV );

sub display_info {
  foreach (shift) {
    my ($ip, $host, $aliases, $addrtype, $length, @addrs);
    $ip = $_;
    if ( /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ ) {
      print "IP is $ip\n";
      ($host, $aliases, $addrtype, $length, @addrs) =
         gethostbyaddr( pack( 'C4', $1, $2, $3, $4 ), AF_INET );
      die "Reverse lookup failed to find name for $ip\n" unless $host;
    }
    $host = $ip unless $host;
    print "Hostname is $host\n";
    ($host, $aliases, $addrtype, $length, @addrs) = gethostbyname(
$host );
    die "Lookup failed to find address for $host\n" unless @addrs;
    print "Maps to these IPs:\n";
    foreach (@addrs) {
      print "IP: ".join( '.', unpack( 'C4', $_ ) )."\n";
    }
  }
}

sub usage {
  print STDERR <<EOM;
Usage: getdnsinfo.pl <IP|host>...
Example `getdnsinfo.pl www.interarchy.com'
EOM
  exit( 0 );
}
---------------------------------------------------------------------------

When I execute with the following cmdline:

$ perl getdnsinfo.pl netscape.com

then I get the following output:

Hostname is netscape.com
Maps to these IPs:
IP: 152.163.211.51

but when I execute with the ip address I got from this output:

$ perl getdnsinfo.pl 152.163.211.51

then I am getting the following output:

Hostname is nscp-rtc-vipb.websys.aol.com
Maps to these IPs:
IP: 152.163.211.51

I am unable to get the original hostname 'netscape.com' instead of
'nscp-rtc-vipb.websys.aol.com'.
How can I get the original hostname?

Any help will be highly appreciated.

~ Ani



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

Date: 19 Jul 2006 10:16:58 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: hostname <-> ip address
Message-Id: <4i6f4qF2d50fU1@news.dfncis.de>

Ani <call.anirban@gmail.com> wrote in comp.lang.perl.misc:
> Hi All,
> If I use the following script to get ip address if i supply a hostname
> & vice-versa:

[...]

> When I execute with the following cmdline:
> 
> $ perl getdnsinfo.pl netscape.com
> 
> then I get the following output:
> 
> Hostname is netscape.com
> Maps to these IPs:
> IP: 152.163.211.51
> 
> but when I execute with the ip address I got from this output:
> 
> $ perl getdnsinfo.pl 152.163.211.51
> 
> then I am getting the following output:
> 
> Hostname is nscp-rtc-vipb.websys.aol.com
> Maps to these IPs:
> IP: 152.163.211.51
> 
> I am unable to get the original hostname 'netscape.com' instead of
> 'nscp-rtc-vipb.websys.aol.com'.
> How can I get the original hostname?

That has nothing to do with Perl, it's a question about DNS.  An IP
address can be associated with one primary domain name and any number
of aliases.  All aliases resolve to the same IP address.  The IP
address resolves to the primary domain name.  Possible aliases are
not delivered.  At least that's how every DNS worked that I looked at.

IOW, your "original hostname" is not the primary host name but an
alias.  You won't get it back from gethostbyaddr() (and neither
from gethostbyname()).

Anno


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

Date: 19 Jul 2006 03:23:10 -0700
From: "Ani" <call.anirban@gmail.com>
Subject: Re: hostname <-> ip address
Message-Id: <1153304590.294867.223530@m79g2000cwm.googlegroups.com>

Thanks Anno!

Is it possible to get the list of aliases associated with an IP
address?

~ Ani

anno4...@radom.zrz.tu-berlin.de wrote:
> Ani <call.anirban@gmail.com> wrote in comp.lang.perl.misc:
> > Hi All,
> > If I use the following script to get ip address if i supply a hostname
> > & vice-versa:
>
> [...]
>
> > When I execute with the following cmdline:
> >
> > $ perl getdnsinfo.pl netscape.com
> >
> > then I get the following output:
> >
> > Hostname is netscape.com
> > Maps to these IPs:
> > IP: 152.163.211.51
> >
> > but when I execute with the ip address I got from this output:
> >
> > $ perl getdnsinfo.pl 152.163.211.51
> >
> > then I am getting the following output:
> >
> > Hostname is nscp-rtc-vipb.websys.aol.com
> > Maps to these IPs:
> > IP: 152.163.211.51
> >
> > I am unable to get the original hostname 'netscape.com' instead of
> > 'nscp-rtc-vipb.websys.aol.com'.
> > How can I get the original hostname?
>
> That has nothing to do with Perl, it's a question about DNS.  An IP
> address can be associated with one primary domain name and any number
> of aliases.  All aliases resolve to the same IP address.  The IP
> address resolves to the primary domain name.  Possible aliases are
> not delivered.  At least that's how every DNS worked that I looked at.
>
> IOW, your "original hostname" is not the primary host name but an
> alias.  You won't get it back from gethostbyaddr() (and neither
> from gethostbyname()).
> 
> Anno



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

Date: 18 Jul 2006 21:57:32 -0700
From: perltcl@yahoo.com
Subject: how to extract multi-line text
Message-Id: <1153285052.012637.41010@s13g2000cwa.googlegroups.com>

hi

how to extract multi-line text from a text file looking like this:
#!/bin/bash

 ...

BEGIN_TOKEN
multi-line text 1
 ......
 ......
END_TOKEN

BEGIN_TOKEN
multi-line text 2
 ......
 ......
END_TOKEN

BEGIN_TOKEN
multi-line text 3
 ......
 ......
END_TOKEN

I need to extract all text between "BEGIN_TOKEN" and "END_TOKEN", and
pipe it to standard output.

thanks.



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

Date: Wed, 19 Jul 2006 05:15:29 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: how to extract multi-line text
Message-Id: <Xns9805CE3CF927asu1cornelledu@127.0.0.1>

perltcl@yahoo.com wrote in news:1153285052.012637.41010
@s13g2000cwa.googlegroups.com:

> how to extract multi-line text from a text file looking like this:

Please read the posting guidelines for this group. There are many 
different ways of solving this problem: What have you tried, what went 
wrong?

But, it looks like you are here get free fish rather than learning how 
to fish. So, here is your fish:

#!/usr/bin/perl

use strict;
use warnings;


{{
    local $/ = "END_TOKEN\n";
    while ( my $chunk = <DATA> ) {
        chomp $chunk;
        if ( $chunk =~ /BEGIN_TOKEN\n(.+)/s ) {
            print $1;
        }
    }
}}

__DATA__
#!/bin/bash
#
#.. . .
#

BEGIN_TOKEN
multi-line text 1
 ......
 ......
END_TOKEN

BEGIN_TOKEN
multi-line text 2
 ......
 ......
END_TOKEN

BEGIN_TOKEN
multi-line text 3
 ......
 ......
END_TOKEN

D:\UseNet\clpmisc> mt
multi-line text 1
 ......
 ......
multi-line text 2
 ......
 ......
multi-line text 3
 ......
 ......

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: 19 Jul 2006 00:24:28 -0700
From: "AbhiSawa" <abhisawa@gmail.com>
Subject: Re: how to extract multi-line text
Message-Id: <1153293868.808957.200890@b28g2000cwb.googlegroups.com>


perltcl@yahoo.com wrote:
> hi
>
> how to extract multi-line text from a text file looking like this:
> #!/bin/bash
>
> ...
>
> BEGIN_TOKEN
> multi-line text 1
> ......
> ......
> END_TOKEN
>
> BEGIN_TOKEN
> multi-line text 2
> ......
> ......
> END_TOKEN
>
> BEGIN_TOKEN
> multi-line text 3
> ......
> ......
> END_TOKEN
>
> I need to extract all text between "BEGIN_TOKEN" and "END_TOKEN", and
> pipe it to standard output.
>
> thanks.


One more small fish

perl -ne 'print if /^BEGIN_TOKEN$/ .. /^END_TOKEN$/'   filename


AbhiSawa



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

Date: Tue, 18 Jul 2006 22:44:19 -0400
From: Carl Lafferty <laff7430@bellsouth.net>
Subject: Re: Net::Telnet - Library Application
Message-Id: <5%gvg.11979$Bx.5623@bignews5.bellsouth.net>

> How did you tickle it to give you data?
> 
Packet sniffed.  I installed the program on my machine (XP) and ran a 
sniffer to capture the data to my server.  performed the basic functions 
I wanted to emulate and the rest is history.



> Don't quote me on this but something like:
> 
>  /$sdelim(?:(.{26}?)$edelim$/
> 
I am going to have to do some work on regex's. . Kinda rudimentary 
understanding of it at best and that completely LOST me.



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

Date: Wed, 19 Jul 2006 00:16:39 -0400
From: Carl Lafferty <laff7430@bellsouth.net>
Subject: Re: Net::Telnet - Library Application
Message-Id: <tiivg.12567$ZH1.7609@bignews4.bellsouth.net>

>>  /$sdelim(?:(.{26}?)$edelim$/
>>
> I am going to have to do some work on regex's. . Kinda rudimentary 
> understanding of it at best and that completely LOST me.
> 

OK, I did some quick reading.  I have found out a few things.

1.  I can use /.{59}/ to grab 59 characters at a time
2.  it didn't work immediately till I read deeper into net::telnet and 
found the prematch option on getting my info  I think that may solve a 
few of my problems.
3.  My library (I have worked here since 92) will often have many copies 
of a book, each one generating a different item.  Checking availability 
  for each book generates x*59 bytes of data which the company that 
supplies our server THEN delimits with (you guessed it) \x8f.

The result is that right before the availability line there is a line 
that (among other things) tells me how many availability lines there 
are.  Now if I get say 3 lines each line is 59 chars long BUT on the 
second line one of them will be that stinking \x8f.

6.5:1116 00183 003
6.7: 003
7 F ROWLING             IN             FCPL           Fiction

7.1 Length of info is 59
7.2 prematch is
7 F ROWLING             Due:01-May-06  FCPL           Fictio

7.1 Length of info is 59
7.2 prematch is
7 nF ROWLING             Due:26-Mar-04  FCLB           Ficti

7.1 Length of info is 59
7.2 prematch is


line 6.7 is the line that tells me how many are available (harry potter 
and sorcerers stone if anyone is interested)  Not that the first 7 has 
Fiction spelled out, the next 7 line has Fictio and the next one has 
Ficit.  The third 7 line has the 'n' from the previous line.
I *think* I can fix it with a kludge of my own but ... well it's late 
and that is my progress report.

in the end, sleep wins..


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

Date: Wed, 19 Jul 2006 12:50:21 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: please urgent
Message-Id: <s4vrb25oviaiend10vbhcck33006g5fmro@4ax.com>

On 18 Jul 2006 01:30:55 -0700, "jeni" <jenish.g@gmail.com> wrote:

>Subject: please urgent

What?

>how to read ms word document and manipulate the document using
>win32::OLE.

And the question is?


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Tue, 18 Jul 2006 20:05:49 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Premature end of script headers: mail.cgi
Message-Id: <slrnebr1bd.5ta.tadmc@magna.augustmail.com>

yusuf <yusufm@gmail.com> wrote:


> If you take out the loop,
> it works:


If you take out the syntax errors it works.

What a concept!


> for (my $i=0; i<100000; i++){
               ^^        ^^

Where are the dollar signs?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 19 Jul 2006 00:12:01 -0700
From: usenet@DavidFilmer.com
Subject: Re: Premature end of script headers: mail.cgi
Message-Id: <1153293121.373584.272550@i3g2000cwc.googlegroups.com>

yusuf wrote:
> Sorry, the script below has other errors (in the for loop), please
> ignore the posting.

Indeed it does (as Tad has also pointed out).

FWIW, the mesage you are seeing ("premature end...") is
characteristicly displayed in a browser when a  CGI program is invoked
but the program fails because of a syntax or runtime error. The script
generates error messages (or maybe nothing at all), but the browser is
expecting a proper HTML page with (at least) a proper HTML header.
When the CGI program exits without providing the browser some valid
HTML, the browser complains.

The CGI::Carp statement I furnished _SHOULD_ have shown you the error
messages in the browser (ie, the same error messages you would see in a
shell).  You say that "nothing" happens, which (as Paul points out) is
a rather inadequate description.

Your question focused on the part of your script which produces output.
But your script never got that far.

-- 
David Filmer (http://DavidFilmer.com)



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

Date: 18 Jul 2006 23:24:33 -0700
From: "Marshall" <marshall.spight@gmail.com>
Subject: Re: What is a type error?
Message-Id: <1153290273.890438.56440@i3g2000cwc.googlegroups.com>

Joachim Durchholz wrote:
> Marshall schrieb:
> > Chris Smith wrote:
> >> Joachim Durchholz <jo@durchholz.org> wrote:
> >> I *think* I understand Marshall here.  When you are saying "assignment",
> >> you mean assignment to values of attributes within tuples of the cell.
> >> When Marshall is saying "assignment", he seems to mean assigning a
> >> completely new *table* value to a relation; i.e., wiping out the entire
> >> contents of the relation and replacing it with a whole new set of
> >> tuples.  Your assignment is indeed less powerful than DML, whereas
> >> Marshall's assignment is more powerful than DML.
> >
> > Exactly.
>
> Ah well. I never meant that kind of assignment.

Sorry for the confusion.


Marshall



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

Date: Tue, 18 Jul 2006 22:34:14 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: why is  perl -e 'unlink(glob("*"))' so much faster than rm ?
Message-Id: <34mdnYudApviWSDZnZ2dnUVZ_rmdnZ2d@comcast.com>

Dr.Ruud wrote:
> Glenn Jackman schreef:
> 
>>>  rm -f *
>> These solutions look in the current directory only.
> 
>   rm -rf *

That will delete files with data in them, not just the zero-length files.
	-Joe


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

Date: Tue, 18 Jul 2006 22:43:45 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: why is  perl -e 'unlink(glob("*"))' so much faster than rm ?
Message-Id: <u6OdnZvF0-UhWyDZnZ2dnUVZ_qmdnZ2d@comcast.com>

ewaguespack@gmail.com wrote:
> i had a situation that required that i remove several thousand zero
> byte files, and i tried this first:
> 
> # find . -type f -exec rm -f {} \;
> 
> this was taking ages, so on a hunch I decided to try this to see it I
> got any better results:
> 
> # perl -e 'unlink(glob("*"))'
> 
> surprisingly the perl unlink took about a quarter of a second to remove
> 1000 files versus 30 seconds with find / rm
> 
> any idea why?

No surprise at all, for people who have used 'find' often.
The answer is: don't use -exec, use 'xargs' instead.

    find . -type f -size 0 -print | xargs rm
or
    find . -type f -size 0 -print0 | xargs -0 rm

And, as you may have noticed, 'rm *' can all too often fail with "Arguments
too long", whereas unlink(glob("*")) does not have that problem.

	-Joe


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

Date: Wed, 19 Jul 2006 12:37:33 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: why is  perl -e 'unlink(glob("*"))' so much faster than rm ?
Message-Id: <e9l9fu.14k.1@news.isolution.nl>

Joe Smith schreef:
> Dr.Ruud:
>> Glenn Jackman:

>>>>  rm -f *
>>>
>>> These solutions look in the current directory only.
>>
>>   rm -rf *
>
> That will delete files with data in them, not just the zero-length
> files.

There were only zero-length files, is what I understood.
But I guess `rm -rf *` will get you the dreaded "argument list is too
long" as well.

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: Tue, 18 Jul 2006 22:49:03 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: why is perl -e 'unlink(glob("*"))' so much faster than rm ?
Message-Id: <5pydneRBE95nWiDZnZ2dnUVZ_tWdnZ2d@comcast.com>

ewaguespack@gmail.com wrote:

> I am still curious why it was so much faster.

The real question is "why does it take so long to execute /bin/rm several
thousand times, as opposed to executing /usr/bin/perl once?".  The answer
to that should be obvious.
	-Joe


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

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 9498
***************************************


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