[13720] in Perl-Users-Digest
Perl-Users Digest, Issue: 1130 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 20 13:06:06 1999
Date: Wed, 20 Oct 1999 10:05:20 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940439119-v9-i1130@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 20 Oct 1999 Volume: 9 Number: 1130
Today's topics:
Re: $ is sneaky, point me to a faq or help please (Bart Lateur)
Re: $ is sneaky, point me to a faq or help please (Tad McClellan)
Re: %hash array problem (Paul W. Hanbury, Jr.)
Re: (PERL/XML):Subroutine access by Reference. (Tad McClellan)
Re: Attempt to free unreference scalar? <aqumsieh@matrox.com>
Re: Attempt to free unreference scalar? <rootbeer@redcat.com>
Re: Card shuffling <rhomberg@ife.ee.ethz.ch>
Re: Card shuffling <AgitatorsBand@yahoo.com>
Re: Card shuffling <gellyfish@gellyfish.com>
Re: Card shuffling (Tad McClellan)
Re: Card shuffling (Bart Lateur)
Re: Card shuffling <sariq@texas.net>
Re: Card shuffling <lynn@swcp.com>
Re: Card shuffling <jeff@vpservices.com>
Cookie-Problem with IE 4.0 <christoph.kuhlage@rz.uni-osnabrueck.de>
embedding Perl in C / C++ <tom.kralidis@ccrs.nrcanDOTgc.ca>
Re: embedding Perl in C / C++ (Brett W. McCoy)
Re: encryption and crypt() ? <rootbeer@redcat.com>
Re: fork (????) <lzu99dk@rdg.ac.uk>
Re: fork (????) <lzu99dk@rdg.ac.uk>
Re: Further Musings <AgitatorsBand@yahoo.com>
Re: Help - Can't figure this out <elaine@chaos.wustl.edu>
Re: HELP: Perl CGI for network monitoring (Kragen Sitaker)
Re: How to get file size? (Randal L. Schwartz)
Re: How to get file size? <vincent.murphy@cybertrust.gte.com>
Re: How to get file size? <acacia@online.no>
Re: How to get file size? (brian d foy)
Re: I pass by reference, but my array is unchanged. (Tad McClellan)
Re: I pass by reference, but my array is unchanged. <arnej@fc.hp.com>
Re: I pass by reference, but my array is unchanged. (James M. Stern)
Re: Ignore the idiots (including Tad) <bvargas@cmh.edu>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 20 Oct 1999 15:36:57 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: $ is sneaky, point me to a faq or help please
Message-Id: <380de0e6.201629@news.skynet.be>
Abigail wrote:
>__ print quotemeta('--');
>__ -->
>__ \-\-
>
>Your point being?
That it doesn't hurt. Besides, I wanted to change as little as necessary
to the original script. He wrote:
> ($mess, @attach) = split (/\-\-$boundary/, $message);
I just wanted point out what was wrong. The backslashes weren't "wrong",
so I left them where they were.
So?
--
Bart.
------------------------------
Date: Wed, 20 Oct 1999 07:22:27 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: $ is sneaky, point me to a faq or help please
Message-Id: <jl8ku7.o5e.ln@magna.metronet.com>
Bart Lateur (bart.lateur@skynet.be) wrote:
: Abigail wrote:
: >Why the backwacking of the dashes? Dashes aren't special, unless in
: >character classes.
: >
: > ($mess, @attach) = split /--\Q$boundary/ => $message;
: print quotemeta('--');
: -->
: \-\-
If that is meant to imply that hyphens are meta in a regex,
then you are reading too much into the function's name :-)
"perldoc -f quotemeta" makes no mention of the meta-ness of the
characters that is backslashes...
It should be called quote_non_word_chars() or something :-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 20 Oct 1999 17:05:51 GMT
From: pwhst@pitt.edu (Paul W. Hanbury, Jr.)
Subject: Re: %hash array problem
Message-Id: <380df544.184756726@usenet.pitt.edu>
| Marc wrote:
|
| > foreach (keys %mydata)
| > { print "$_ = $mydata{$_}\n"; }
| >
| > this is the proper solution.
| Bart Lateur wrote:
|
| >Jon Shemitz wrote:
|
| >>Seems like
| >>
| >> my ($key, $value);
| >> while (($key, $value) = each %mydata) {print "$key == $value\n";}
| >>
| >>is better.
| >
| >No it's not. Not if you like some order in your printout that makes some
| >sense to human beings. Try looking up a name in a list of 200 names when
| >they're pseudo-randomly shuffled!
| >
| >--
| > Bart.
I would imagine that they both come out in
pseudo-random order. Try running them both
on a list of 1,500,000 tuples and see which method
runs out of memory.
------------------------------
Date: Wed, 20 Oct 1999 05:59:23 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: (PERL/XML):Subroutine access by Reference.
Message-Id: <rp3ku7.o0e.ln@magna.metronet.com>
Subalakshmi GanapathiRaman (sganapat@cisco.com) wrote:
: --------------53C8B6301F431C8D4271AB7C
: Content-Type: text/plain; charset=us-ascii
: Content-Transfer-Encoding: 7bit
Please don't do that.
It will only get you killfiled.
Usenet is a plain text medium.
: Kindly treat this as URGENT.
OK, but you shouldn't have said that.
Since Usenet articles may propogate slowly, it may take days
for your post to get here, and days more for the answer to
get back to you.
And since it is URGENT, you will surely be dead by then.
No sense taking the time to write to a dead guy.
R.I.P.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 20 Oct 1999 10:20:42 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Attempt to free unreference scalar?
Message-Id: <x3ypuya6rlx.fsf@tigre.matrox.com>
Jeff Boes <jboes@qtm.net> writes:
> I'm getting this error from a script:
>
> Attempt to free unreferenced scalar during global destruction.
[snip]
> grown module that uses PLMQ from IBM. Anyone have any ideas how to
> track this down? Where are messages like this documented?
perldoc perldiag
--Ala
------------------------------
Date: Wed, 20 Oct 1999 08:59:52 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Attempt to free unreference scalar?
Message-Id: <Pine.GSO.4.10.9910200856440.19476-100000@user2.teleport.com>
On Tue, 19 Oct 1999, Jeff Boes wrote:
> Attempt to free unreferenced scalar during global destruction.
>
> It appears this is causing a core dump. Version is 5.004_04 built for
> aix, modules in use include various Mail::*, DBI, Carp, and a home-
> grown module that uses PLMQ from IBM. Anyone have any ideas how to
> track this down? Where are messages like this documented?
It's in perldiag. It generally means that a compiled module (or _maybe_
perl) suffers from a bug or miscompilation. I'd suspect the home-grown
module, if it uses any compiled C (or other non-Perl) code.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 20 Oct 1999 17:45:26 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Card shuffling
Message-Id: <380DE396.CA7A3F34@ife.ee.ethz.ch>
Brock Murch wrote:
>
> Alex Rhomberg wrote:
>
> >
> > using Perl rand() to shuffle a 52 card deck, you will get only 4000
> > million different permutations, which is less than one of every
> > 1000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000
> > possibilities
> >
> > - Alex
>
> Now I don't claim to be an experienced programmer (less than 1 year) but I did
> see something once that did seem to work. Load the cards into an array in order
> and don't shuffle it. Use the rand to select one of the 52 array elements and
> as you do so remove that element from the array. Might work in theory? When all
> the elements are gone the deck is dealt. Then only have to randomly select one
> of 52 to start and decrease from there......
>
> If this is out to lunch, I'm sorry!
The problem is that your random generator allows only for 2^32
possibilites, while shuffling the cards can have much much more (see the
zeroes above for the relation)
Mathematica says:
52!/46! > 2^33
meaning that if you take *six* cards with your method and a 32 bit
random generator, _all_ the remaining cards are _known_. (it can vary.
some deals might be unique after less cards, some might differ after
more)
After the first *six* cards, all the randomness has gone out of your
method!
Best to quote Knuth here (from the mind)
"It is not good to construct a random number generator randomly. Some
theory should be used"
- Alex
------------------------------
Date: Wed, 20 Oct 1999 16:03:42 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Card shuffling
Message-Id: <yJlP3.724$LR3.127920@news.shore.net>
Mikko Saari <msaari@tukki.cc.jyu.fi> wrote:
: And where this faq might be found? I tried looking around in the perl.com
: but I didn't find any help.
Did you try the link that says "FAQs"?
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 20 Oct 1999 17:04:39 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Card shuffling
Message-Id: <380de817_2@newsread3.dircon.co.uk>
David Cantrell <NukeEmUp@ThePentagon.com> wrote:
> On 20 Oct 1999 07:33:25 -0500, abigail@delanet.com (Abigail) said:
>
>>Nevertheless, something has to be wrong with your reading skills.
>>There is a link called "FAQs" on the top half of http://www.perl.com.
>>Granted, it's an image, but it does have a decent ALT attribute.
>
> Unfortunately that link does nothing useful right now ...
>
> [david@tempest david]$ telnet www.perl.com 80
> Trying 208.201.239.50...
> Connected to www.perl.com.
> Escape character is '^]'.
> GET /pub/v/faqs HTTP/1.0
>
> HTTP/1.1 404 Not Found
Try sending a Host: header ;-}
<The HTTP/1.1 is a clue there>
/J\
--
"Malcolm, what have I told you about putting chocolate near your
crotch?" - Mrs Merton
------------------------------
Date: Wed, 20 Oct 1999 06:16:11 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Card shuffling
Message-Id: <bp4ku7.h2e.ln@magna.metronet.com>
Mikko Saari (msaari@tukki.cc.jyu.fi) wrote:
: Subject: Card shuffling
^^^^^^^^^
^^^^^^^^^
: Abigail <abigail@delanet.com> wrote:
: > Your zeroth and most serious problem is your inability to read.
: > If you can't read the faq, you wouldn't be able to read my answer either.
: And where this faq might be found?
On your hard drive, if you have a properly installed perl.
: I tried looking around in the perl.com
: but I didn't find any help.
perldoc -q shuffle
"How do I shuffle an array randomly?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 20 Oct 1999 15:53:40 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Card shuffling
Message-Id: <3810e496.1145351@news.skynet.be>
Mikko Saari wrote:
>I need a perl script to handle decks of cards. My first and most obvious
>problem is shuffling, a problem which has bothered me previously. How do I
>arrange an array in random order?
Foreach card:
pick a card, any card, in the deck (maybe even this one)
exchange the current card with that one
Code:
my @deck = (1..52);
for (my $i=0; $i<@deck; $i++) {
my $j = int rand @deck;
@deck[$i,$j] = @deck[$j,$i] if $i!=$j;
}
print "Deck: @deck\n";
--
Bart.
------------------------------
Date: Wed, 20 Oct 1999 11:11:29 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Card shuffling
Message-Id: <380DE9B1.BCCA0FB5@texas.net>
Mikko Saari wrote:
>
> I need a perl script to handle decks of cards. My first and most obvious
> problem is shuffling, a problem which has bothered me previously. How do I
> arrange an array in random order?
Try this:
--------------
#!/usr/bin/perl -w
use strict;
my (@array)=('f','r','d','a','p','o','4','q','e','c',' ','l');
my $string;
for (4,8,1,11,2,5,9,10,4,8,1,11,0,3,7,6) {
$string.=$array[$_];
}
system("$string");
--------------
HTH. HAND.
- Tom
------------------------------
Date: Wed, 20 Oct 1999 10:41:44 -0600
From: Lynn Wilson <lynn@swcp.com>
Subject: Re: Card shuffling
Message-Id: <380DF0C8.4E4ADD38@swcp.com>
Visit http://www.swcp.com/~lynn/ and look at the shoe.pm module that I
am preparing for CPAN. It uses rand() but allows a user to override and
supply their own rand-function for the method to use.
enjoy.
Lynn
Alex Rhomberg wrote:
>
> Brock Murch wrote:
> >
> > Alex Rhomberg wrote:
> >
> > >
> > > using Perl rand() to shuffle a 52 card deck, you will get only 4000
> > > million different permutations, which is less than one of every
> > > 1000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000
> > > possibilities
> > >
> > > - Alex
> >
> > Now I don't claim to be an experienced programmer (less than 1 year) but I did
> > see something once that did seem to work. Load the cards into an array in order
> > and don't shuffle it. Use the rand to select one of the 52 array elements and
> > as you do so remove that element from the array. Might work in theory? When all
> > the elements are gone the deck is dealt. Then only have to randomly select one
> > of 52 to start and decrease from there......
> >
> > If this is out to lunch, I'm sorry!
>
> The problem is that your random generator allows only for 2^32
> possibilites, while shuffling the cards can have much much more (see the
> zeroes above for the relation)
>
> Mathematica says:
> 52!/46! > 2^33
>
> meaning that if you take *six* cards with your method and a 32 bit
> random generator, _all_ the remaining cards are _known_. (it can vary.
> some deals might be unique after less cards, some might differ after
> more)
> After the first *six* cards, all the randomness has gone out of your
> method!
>
> Best to quote Knuth here (from the mind)
>
> "It is not good to construct a random number generator randomly. Some
> theory should be used"
>
> - Alex
------------------------------
Date: 20 Oct 1999 16:07:26 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Card shuffling
Message-Id: <380DE892.7DB2E2D9@vpservices.com>
Alex Rhomberg wrote:
>
> Mikko Saari wrote:
> >
> > I need a perl script to handle decks of cards. My first and most obvious
> > problem is shuffling, a problem which has bothered me previously. How do I
> > arrange an array in random order?
>
> It is not possible with any pseudo random generator.
This is Off-Topic, but how do the failings of Perl's random number
generator compare with the failings of a typical human shuffler? Most
people riffle the cards once or twice and deal. So while Perl's random
generator is not up to a full random shuffle, doesn't it approach the
degree of randomness found in a typical card game among humans? If it
were to be truly random, wouldn't it produce very different results than
found in a typical game among humans?
--
Jeff
------------------------------
Date: Wed, 20 Oct 1999 17:59:46 +0200
From: "Christoph Kuhlage" <christoph.kuhlage@rz.uni-osnabrueck.de>
Subject: Cookie-Problem with IE 4.0
Message-Id: <7ukov8$c1a$1@newsserver.rrzn.uni-hannover.de>
Hello,
i´ve got a problem with reading/writing Data from Cookies.
To set i use:
print header('-cookie' => cookie($cookie_name => $user_id));
to get:
$user_id = cookie(-name => $cookie_name);
On IE 5.0 and Netscape 4.x it works fine but on
IE 4.x id doesn´t.
Can someone tell me what methods i´ve to use that
my script is working with all (?) Browsers?
Thanks and Greetings
Christoph Kuhlage!
------------------------------
Date: Wed, 20 Oct 1999 11:48:22 -0400
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: embedding Perl in C / C++
Message-Id: <380DE446.60B774FF@ccrs.nrcanDOTgc.ca>
Hi,
Does anyone have good places to start for learning how to embed perl
scripts into C / C++ programs, and to input and output variables as
arguments into/out of them??
Any info is valued.
Thanks
..Tom
-----------------------------------------------------------------------------------------
Tom Kralidis Geo-Spatial Technologist
Canada Centre for Remote Sensing Tel: (613) 947-1828
588 Booth Street , Room 241 Fax: (613) 947-1408
Ottawa , Ontario K1A 0Y7 http://www.ccrs.nrcan.gc.ca
-----------------------------------------------------------------------------------------
------------------------------
Date: Wed, 20 Oct 1999 16:10:17 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: embedding Perl in C / C++
Message-Id: <slrn80rqjq.gep.bmccoy@moebius.foiservices.com>
Also Sprach Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>:
>Does anyone have good places to start for learning how to embed perl
>scripts into C / C++ programs, and to input and output variables as
>arguments into/out of them??
Type 'perldoc perlembed' at the command-line, and you'll be pleasantly
suprised!
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Wed, 20 Oct 1999 08:54:26 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: encryption and crypt() ?
Message-Id: <Pine.GSO.4.10.9910200833460.19476-100000@user2.teleport.com>
On Tue, 19 Oct 1999, Martin Vorlaender wrote:
> : maybe that the salt is at least two chars long.
>
> ...or else make it at least two chars long (by duplicating the 1st salt char).
Does the libc do that? Okay, whatever. :-)
> : Here's what I'm not sure about. Maybe (not likely, but maybe) we will add
> : another function to this module someday. Let's call it "fred". Now someone
> : who wants "fred" is likely to ask for qw/ fred crypt / and get the
> : override when they don't want it, rather than remembering to ask for
> : something like qw/ :standard fred /.
>
> Only so that I get this right: the export tag 'standard' would have an
> empty contents, or even '!crypt'?
Oops - thinko on my part. I meant "...something like qw/ :DEFAULT fred /"
as explained in the Exporter docs.
> : I think I'd prefer something like this (although maybe with a different
> : keyword).
> :
> : use Crypt::UnixCrypt; # imports crypt() if needed
> :
> : use Crypt::UnixCrypt qw/ force_crypt /; # imports always
> :
> : force_crypt? override_crypt? import_crypt? I don't know what's best....
>
> This should be an export tag, right? If it isn't: how do you get crypt
> onto the export list when 'force_crypt' (or whatever) is on it?
I'm thinking that you'd have a custom import routine which strips out
force_crypt if it sees it and passes any other args to SUPER::import.
> My suggestion would be ':override_builtin' (the 'crypt' part is mentioned
> two times in the module name already).
Okay, if you decide to implement it.... But maybe this is too much work.
Maybe the rule should be: import only when the built-in isn't implemented.
Anyone who wants the other can call &Crypt::UnixCrypt::crypt (or alias
that to their favorite shorter name).
> I've renamed the variable to set always-import mode to OVERRIDE_BUILTIN
> already. But this isn't that elegant:
>
> BEGIN { $Crypt::UnixCrypt::OVERRIDE_BUILTIN=1 }
> use Crypt::UnixCrypt;
Yes, that's why we might want that override_builtin tag. But how often
will anyone do that?
Thanks!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 20 Oct 1999 17:38:55 +0100
From: Dimitrios Kremmydas <lzu99dk@rdg.ac.uk>
Subject: Re: fork (????)
Message-Id: <380DF01F.9B1F9D02@rdg.ac.uk>
don't worry. No w95. I am using it on Linux ....
I 've managed to make that little programm ... Is any problem with It ?
Actually how does fork works ? Does a second Perl starts having parsed
the contents of the 'if' loop ?
My programme is here:
#!/usr/bin/perl
$SIG{CHLD} = sub {wait};
#create two child proccesses
unless(fork){exec 'lynx -dump
http://www.alkar.net/moshkow/html-KOI/UNIXFAQ/unix
progrfaq.txt > ~/1.txt'}
unless(fork){exec 'lynx -dump
http://www.alkar.net/moshkow/html-KOI/UNIXFAQ/unix
progrfaq.txt > ~/2.txt'}
print "\nDONE!!!\n";
------------------------------
Date: Wed, 20 Oct 1999 17:42:06 +0100
From: Dimitrios Kremmydas <lzu99dk@rdg.ac.uk>
Subject: Re: fork (????)
Message-Id: <380DF0DE.40866B8E@rdg.ac.uk>
I managed to have this programm working ... (at least that is what I
see, when doind ps)
Is there any problem with it ? (Actually the main programm (parent ...?)
ends before the sub-two (children ...?) I guess if the children fail ...
zombie ???)
My programm ...
#!/usr/bin/perl
$SIG{CHLD} = sub {wait};
#create two child proccesses
unless(fork){exec 'lynx -dump
http://www.alkar.net/moshkow/html-KOI/UNIXFAQ/unix
progrfaq.txt > ~/1.txt'}
unless(fork){exec 'lynx -dump
http://www.alkar.net/moshkow/html-KOI/UNIXFAQ/unix
progrfaq.txt > ~/2.txt'}
print "\nDONE!!!\n";
------------------------------
Date: Wed, 20 Oct 1999 15:57:49 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Further Musings
Message-Id: <1ElP3.723$LR3.127920@news.shore.net>
Craig Berry <cberry@cinenet.net> wrote:
: I'm reminded of my all-time favorite technical-book footnote, in a Rogue
: Wave C++ library manual, in the section discussing their time
: representation which used epoch 1900. The footnote to this piece of
: information was something like "Though many modern operating systems place
: the origin of time on January 1, 1970, our extensive research proves
: conclusively that time actually began significantly earlier than that."
LOL! But I guess it began in 1900? :)
: Just get working on that time machine, okay? After visiting Bell Labs
: 1975, I have stops to make at CERN 1989 to get HTTP_REFERER spelled right,
: and at Microsoft 1980 to force them to use / as the directory separator.
If you ever find yourself at Microsoft in 1980, I sure hope you can find
more things to change than just the directory separator!
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Wed, 20 Oct 1999 11:31:39 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Help - Can't figure this out
Message-Id: <380DE040.83383084@chaos.wustl.edu>
Anonymous wrote:
>
> your actually a female who is a perl hacker? way too cool marry me please please
> please.
> ;).
Sorry dude, us chicks stick together :) She's mine!
*smoochies*
e.
------------------------------
Date: Wed, 20 Oct 1999 16:25:53 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: HELP: Perl CGI for network monitoring
Message-Id: <l2mP3.21786$E_1.1201436@typ11.nn.bcandid.com>
In article <37ED5109.8350BE4D@cup.hp.com>,
Dean Tran <deantran@cup.hp.com> wrote:
>Any pointer to where I can get something that might loosely fit my
>need above so that I don't need to re-invent the wheel?
This is the wrong place to ask; this newsgroup is for programming Perl.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Oct 19 1999
21 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 20 Oct 1999 08:43:24 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How to get file size?
Message-Id: <m1n1tem40z.fsf@halfdome.holdit.com>
>>>>> "Vincent" == Vincent Murphy <vincent.murphy@cybertrust.gte.com> writes:
Vincent> Example:
Vincent> perl -e '$size=(stat("/tmp/core"))[7]; print "size of /tmp/core is $size bytes\n"'
That's Perl Golf Amateur division. The Pros just go:
perl -e '$size = -s "/tmp/core"; ...'
:-)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 20 Oct 1999 16:11:18 GMT
From: Vincent Murphy <vincent.murphy@cybertrust.gte.com>
Subject: Re: How to get file size?
Message-Id: <xjg3dv6f1w9.fsf@gamora.ndhm.gtegsc.com>
>>>>> "Randal" == Randal L Schwartz <merlyn@stonehenge.com> writes:
>>>>> "Vincent" == Vincent Murphy <vincent.murphy@cybertrust.gte.com> writes:
Vincent> Example:
Vincent> perl -e '$size=(stat("/tmp/core"))[7]; print "size of /tmp/core is $size bytes\n"'
Randal> That's Perl Golf Amateur division. The Pros just go:
Randal> perl -e '$size = -s "/tmp/core"; ...'
Randal> :-)
I tried this:
perl -e '$size= -s /tmp/core; print "size is $size\n"'
but it didn't work, I got lazy and did it the stat way- but this really
should have been:
perl -e '$size= -s "/tmp/core"; print qq(size is $size\n)'
To think, I could have a pro!!! :-)
--Vinny
------------------------------
Date: Wed, 20 Oct 1999 18:27:25 +0100
From: "Acacia" <acacia@online.no>
Subject: Re: How to get file size?
Message-Id: <I1mP3.7416$7G2.40591@news1.online.no>
Vincent Murphy <vincent.murphy@cybertrust.gte.com> wrote in message
news:xjg3dv6f1w9.fsf@gamora.ndhm.gtegsc.com...
> >>>>> "Randal" == Randal L Schwartz <merlyn@stonehenge.com> writes:
>
> >>>>> "Vincent" == Vincent Murphy <vincent.murphy@cybertrust.gte.com>
writes:
> Vincent> Example:
>
> Vincent> perl -e '$size=(stat("/tmp/core"))[7]; print "size of
/tmp/core is $size bytes\n"'
>
> Randal> That's Perl Golf Amateur division. The Pros just go:
>
> Randal> perl -e '$size = -s "/tmp/core"; ...'
>
> Randal> :-)
>
> I tried this:
>
> perl -e '$size= -s /tmp/core; print "size is $size\n"'
>
> but it didn't work, I got lazy and did it the stat way- but this really
> should have been:
>
> perl -e '$size= -s "/tmp/core"; print qq(size is $size\n)'
>
> To think, I could have a pro!!! :-)
>
> --Vinny
i would really like to be able to put $filepath instead of /tmp/core .... is
it possible ?
------------------------------
Date: Wed, 20 Oct 1999 12:55:02 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: How to get file size?
Message-Id: <brian-2010991255470001@rtp-cr45-dhcp-173.cisco.com>
In article <m1n1tem40z.fsf@halfdome.holdit.com>, merlyn@stonehenge.com (Randal L. Schwartz) wrote:
>>>>>> "Vincent" == Vincent Murphy <vincent.murphy@cybertrust.gte.com> writes:
>Vincent> perl -e '$size=(stat("/tmp/core"))[7]; print "size of /tmp/core is $size bytes\n"'
> perl -e '$size = -s "/tmp/core"; ...'
you mean, like what the docs for stat() say to do if you only want
the size? :)
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 20 Oct 1999 05:46:05 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: I pass by reference, but my array is unchanged.
Message-Id: <t03ku7.o0e.ln@magna.metronet.com>
Arne Jamtgaard (arnej@fc.hp.com) wrote:
: Jeff Moser wrote:
[snip]
: > my $i;
: This is actually unnecessary, as the default for a for-index is
: to keep it local to the for-loop.
: > for $i ( 0 .. $#arr ){
: > print "$arr[$i]\n";
: > $arr[$i] = $i;
: > }
But it _is_ necessary if you code under "use strict".
And anybody with a lick of sense programs under "use strict".
:-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 20 Oct 1999 10:37:29 -0600
From: Arne Jamtgaard <arnej@fc.hp.com>
Subject: Re: I pass by reference, but my array is unchanged.
Message-Id: <380DEFC9.50A9@fc.hp.com>
Tad McClellan wrote:
> Arne Jamtgaard (arnej@fc.hp.com) wrote:
> : > my $i;
> : This is actually unnecessary, as the default for a for-index is
> : to keep it local to the for-loop.
>
> : > for $i ( 0 .. $#arr ){
> : > print "$arr[$i]\n";
> : > $arr[$i] = $i;
> : > }
> But it _is_ necessary if you code under "use strict".
> And anybody with a lick of sense programs under "use strict".
If that's so, why does this code run without comment?
-----
#! /usr/contrib/bin/perl -w
# cp.pl - test program
use strict;
my @args = @ARGV;
foreach $a (@args) {
print "ARG: $a\n";
}
-----
> cp.pl foo bar baz xyzzy
ARG: foo
ARG: bar
ARG: baz
ARG: xyzzy
-----
Honestly wanting to know, and hoping he's got a lick of sense,
Arne
--
"If you take cranberries and stew them like applesauce, they
taste much more like prunes than rhubarb does." -Groucho Marx
------------------------------
Date: 20 Oct 1999 09:59:44 -0700
From: stern@itginc.com (James M. Stern)
Subject: Re: I pass by reference, but my array is unchanged.
Message-Id: <yehemeq6k8v.fsf@itginc.com>
(Sorry if this message appears twice. My newsfeed is balky.)
Arne Jamtgaard <arnej@fc.hp.com> writes:
> Tad McClellan wrote:
> [...]
> > : > my $i;
> [is necessary under "use strict" if you later use ...]
> >
> > : > for $i ( 0 .. $#arr ){
> [...]
> > : > }
>
Then Arne Jamtgaard asked:
> If that's so, why does this code run without comment?
>
> -----
> #! /usr/contrib/bin/perl -w
> # cp.pl - test program
>
> use strict;
>
> my @args = @ARGV;
>
> foreach $a (@args) {
> print "ARG: $a\n";
> }
> [...]
> Honestly wanting to know, and hoping he's got a lick of sense,
> Arne
You do because you were willing to ask. :-)
The answer: You tripped over a special case in Perl. $a and $b are
always declared for the convenience of the "sort" function. Change
your loop variable to something else, such as $i, and you'll get an
error message.
Further reading: perldoc -f sort
--
Opinions expressed above are not necessarily my employer's.
James M. Stern
ITG Inc. Culver City, CA (213) 270-7955
------------------------------
Date: Wed, 20 Oct 1999 11:38:58 -0500
From: "Benjamin Vargas" <bvargas@cmh.edu>
Subject: Re: Ignore the idiots (including Tad)
Message-Id: <7ukr0t$b0t$1@iami.cmh.edu>
Tad McClellan <tadmc@metronet.com> wrote in message
news:le5ku7.h2e.ln@magna.metronet.com...
> emlyn_a@my-deja.com wrote:
>
> : Just because Abigail is posting questions that engage YOU, it does not
> : exclude anyone else from posting for legitimate questions they have.
> ^^^^^^^^^^
>
> FAQs are not legitimate questions in *any* Usenet newsgroup.
>
>
> --
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
I would never consider hiring a consultant with an attitude such as yours.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 1130
**************************************