[16480] in Perl-Users-Digest
Perl-Users Digest, Issue: 3892 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 2 21:05:50 2000
Date: Wed, 2 Aug 2000 18:05:28 -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: <965264727-v9-i3892@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 2 Aug 2000 Volume: 9 Number: 3892
Today's topics:
[ANNOUNCE] Sci-BOT v0.13 <lydia_van_dijk@my-deja.com>
Re: A DOS box question <elephant@squirrelgroup.com>
Re: A DOS box question <elephant@squirrelgroup.com>
Re: A DOS box question <elephant@squirrelgroup.com>
Re: Advice on processing a file <mark.drummond@rmc.ca>
Re: Algorithm for efficient creation of unique, random (Logan Shaw)
Re: Breaking up strings into arbitrary lengths (Craig Berry)
can't use global $^W in "my"....fixed <eaglewing@zensearch.com>
CGI.pm cookie failure <daniel@blackomega.com>
Re: day_of_week() and age() without using Date::Calc ? (Keith Calvert Ivey)
Re: Difference between a .cgi file and a .pl file? (brian d foy)
Help with perl please ... <unidam@freenetname.co.uk>
How do I run CGIs on my desktop? <jbr@ntlworld.com>
Re: How do I run CGIs on my desktop? (Marcel Grunauer)
Re: How to recognize triplicates <tim@ipac.caltech.edu>
Re: I have an idea but will it work ? <globalcon2isnot@myhouse.com>
Re: I have an idea but will it work ? <globalcon2isnot@myhouse.com>
Re: I have an idea but will it work ? <globalcon2isnot@myhouse.com>
Re: killing process 1 <bkennedy99@home.com>
Re: killing process 1 <tony_curtis32@yahoo.com>
Re: Need to read a html page and save it via perl Unabl (Abigail)
Newbie needs help. <tarheel@sierratel.com>
Re: Newbie needs help. <tarheel@sierratel.com>
Re: Newbie needs help. <Jonathan.L.Ericson@jpl.nasa.gov>
Re: Newbie needs memory <bkennedy99@home.com>
newbie: multiple file input <zentara@gypsyfarm.com>
Re: newbie: multiple file input (Marcel Grunauer)
Re: non-blocking read from fifo <tim@ipac.caltech.edu>
outputting a CGI script to another frame? j555@my-deja.com
Re: Perl CGI - files occasionally truncated mikelot@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 02 Aug 2000 23:16:56 GMT
From: Lydia van Dijk <lydia_van_dijk@my-deja.com>
Subject: [ANNOUNCE] Sci-BOT v0.13
Message-Id: <8maa54$k9p$1@nnrp1.deja.com>
Changes from 0.12 to 0.13
* user visible
- introduce index (cls)
Note: The index of the printed version is
broken. Chris is working on that.
- extend documentation of API functions
- add section about writing low-level functionals
- make indentation of program listings and
screen-shots consistent
- lots of minor additions, updates, and rewrites
- hibernate graphics chapter
* user invisible
- reorganize directory structure
- convert sources from SGML DocBook 3.1
to XML DocBook 4.1. The SGML-version is no
longer supported.
- replace all gif images with png images
Lydia van Dijk
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 02 Aug 2000 22:38:23 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: A DOS box question
Message-Id: <MPG.13f34044e35a9f959896ae@news>
BardicStorm writes ..
>
>Jonathan Stowe wrote ..
>
>> After restarting in MS-DOS mode.
>>
>> 'Cannot run this program in DOS mode'
>>
>> ActivePerl requires certain windows services.
>
>Start Windows as normal.. run command.com to open dos while windows is
>running, then use c:\perl <program>
I think you'll find that Jonathan was correctly pointing out that
starting a command shell (by doing what you state above) is NOT running
in DOS mode .. it's running a DOS shell in Windows mode
and just quietly .. what you propose will not work on the majority of
Windows systems .. the perl interpreter is rarely in the root directory
of the C drive
>(remember to make sure you're loading the paths in your autoexec..)
completely unecessary if you're using (as you appear to be trying to do)
explicit paths to the perl interpreter .. also completely false if the
Windows flavour is WindowsNT (and possibly Windows2000 as well)
[ attribution re-added .. signature deleted ]
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 02 Aug 2000 22:41:34 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: A DOS box question
Message-Id: <MPG.13f34102582599a59896af@news>
Guenther Degenfelder writes ..
>
>"James" <jamesmckay@MailAndNews.com> schrieb im Newsbeitrag
>news:398A3C0E@MailAndNews.com...
>> Hi All,
>> Quick question: Is there a way to force a Perl script to run in a
>> DOS box? The script I've written flashes it's error messages on
>> screen too fast to read, then closes it's DOS box. I want to have
>> the DOS box remain on screen after the script completes.
-
>
>Try this:
> Scriptname.pl & pause
umm how is the originator meant to do this when he was clearly double-
clicking on the Perl program icon ?
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 02 Aug 2000 22:51:15 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: A DOS box question
Message-Id: <MPG.13f343213d31cc9c9896b0@news>
Jason Maggard writes ..
>Two methods:
>
>1: put a sleep at the end of your script "sleep 60 ; return 0"
>
>2: The following two lines should be self explanatory:
>print "Press enter to continue..." ;
><STDIN> ;
>
>Also, create a batch file with the line "perl myprog.pl" and then set up a .pif
>(or shortcut) and set the properties for the dos box there.
"Our two weapons are fear and surprise...and ruthless efficiency.... Our
*three* weapons are..."
these 'solutions' are scarey .. are there really this many people around
who don't know how to run a program other than double-clicking on an
icon ?
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 02 Aug 2000 18:04:39 -0400
From: "Mark E. Drummond" <mark.drummond@rmc.ca>
Subject: Re: Advice on processing a file
Message-Id: <39889AF7.B5B4ACC4@rmc.ca>
Answered my own question. The following code fragment does what I want:
open(SMB,"/usr/local/samba/lib/smb.conf");
until (<SMB> =~ /^# SHARES/) {}
while (<SMB>) {
last if (/^# PRINTERS/);
if (/^\[(.*)\]/) { $share = $1 };
if (/^.*path = (.*)/) { $path = $1 };
if ($path) {
print "Creating share $share as c:$path\n";
undef $share; undef $path;
}
}
close SMB;
Comments?
--
Mark Drummond|ICQ#19153754|mailto:mark.drummond@rmc.ca
UNIX System Administrator|Royal Military College of Canada
The Kingston Linux Users Group|http://signals.rmc.ca/klug/
Saving the World ... One CPU at a Time
Please excuse me if I am terse. I answer dozens of emails every day.
------------------------------
Date: 2 Aug 2000 17:23:42 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Algorithm for efficient creation of unique, random array
Message-Id: <8ma71e$f8o$1@provolone.cs.utexas.edu>
In article <3987D4D0.6796@modulus.com.au>,
Peter Hill <phill@modulus.com.au> wrote:
>I need to efficiently select 'x' unique, random (or pseudo-random)
>numbers from 'y' options, where 'y' is the range 0..y.
>What I've done so far is inefficient:
Well, you've already discovered this is an FAQ, but this problem always
reminds me of another problem which I've wanted a good solution for,
but which doesn't seem to be covered by the Fisher-Yates algorithm.
Anyway, imagine you have a list of items paired with floating numbers:
%x = ( "a" => 1.2, "b" => 4.37, "c" => 2.10, "d" => 0.23, "e" => 1.05 );
and you'd like to write a function that will randomly select
one of the items such that the probability of selecting a given
item is proportional to the number paired with the item. So,
for example, "c" should be twice as likely to be selected as
"e" and almost half as likely to be selected as "b".
I've already thought of one way to do this, but I'm wondering if
there is a more efficient way. The way I would do it is to
essentially imagine all the numbers spread out on a (number) line
where the distance from them to their left neighbor is equal to
the probability that they should be selected. Then, I'd pick a
number from zero to the length of that line and pick the number
to the right of the number I picked. I'd model it like this:
$total = 0;
foreach $key (sort keys %x)
{
push (@line, [ $total += $x{$key}, $key ]);
}
This should give me an array like this:
(
[ '1.2', 'a' ],
[ '5.57', 'b' ],
[ '7.67', 'c' ],
[ '7.9', 'd' ],
[ '8.95', 'e' ]
);
Now I can pick a random number between 0 and 8.95 and locate
the appropriate element with a binary search. So that's not
too terrible. It's O(log N) to pick a number given the
list. The problem is, the list is O(N) to build[1], and it
has to be entirely (or almost entirely) rebuilt every time
the number associated with any single item changes.
So, any ideas? I realize this isn't exactly a perl question,
but I think it might be interesting to people here.
- Logan
[1] O.K., technically it's not O(N) because I used the "sort" function
but I just did that so it would look nice in the example.
------------------------------
Date: Wed, 02 Aug 2000 23:49:14 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Breaking up strings into arbitrary lengths
Message-Id: <sohcrqdbdbm70@corp.supernews.com>
Paul King (pking@idirect.com) wrote:
: There has GOT to be a better way to do this. What I want to do is to
: break up a really long string on an arbitrary byte boundary.
You're right, there is a (much) better way. Several billion of them, in
fact. :) The notationally simplest way is probably:
sub cutupline {
my $str = shift;
my $len = 3 * 1024;
$str =~ m/(.{1,$len})/go;
}
Iterating and applying substr is probably more efficient, and there may be
a neat unpack trick as well (though I couldn't find one that dealt well
with short final chunks).
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Turning and turning in the widening gyre
| The falcon cannot hear the falconer." - Yeats, "The Second Coming"
------------------------------
Date: Wed, 2 Aug 2000 16:19:32 -0700
From: "eaglewing" <eaglewing@zensearch.com>
Subject: can't use global $^W in "my"....fixed
Message-Id: <8maadd$657aj$1@ID-41717.news.cis.dfn.de>
if anyone was still interested in the problem I was having, with this
persistent error:
[Thu Jul 27 22:13:06 2000] [error] Can't use global $^W in "my" at
/home/gavin/codebase/v1/scripts/lucia2 line 1
and as Abigail pointed out, it was referencing my shebang line...
#!/usr/local/bin/perl -w
I took off the -w switch, for the crack, and the error disappeared...I then
restored the -w, and the error never came back
odd I know, but I'm not going to worry about it too much :)
thanks for your help
-gavin
------------------------------
Date: Thu, 3 Aug 2000 01:18:22 +0100
From: "Daniel Foster" <daniel@blackomega.com>
Subject: CGI.pm cookie failure
Message-Id: <8mado6$1vt$1@news8.svr.pol.co.uk>
Hi,
I'm trying to save a cookie on a user's machine, with CGI.pm. I tried
to use the cookie() method of a CGI object, but to no avail. Then I
tried with CGI::Cookie, also to no avail. Here's some code...
#!/usr/bin/perl
use CGI;
use CGI::Carp (fatalsToBrowser);
use CGI::Cookie;
$co = new CGI;
$cook2 = new
CGI::Cookie(-name=>'test2', -expires=>'+1h', -value=>'saveme2');
$cook = $co->cookie(
-name=>'test',
-path=>'/',
-expires=>'+1h',
-value=>'saveme'
);
#print $co-header(-cookie=>$cook); # doesn't work
#print $co-header(-cookie=>$cook2); # doesn't work
print $co->header(-cookie=>[$cook,$cook2]); #doesn't work
print 'output';
It's all taken from examples, so I figured it should work. All that
happens is 'output' gets printed in the browser, and so would anything
else I put there, like a real HTML page or something. This has been
driving me mad, since nothing I do seems to make any difference.
Can anyone shed some light on the reasons why the cookies are not
getting sent to the browser?
---
The path of my life is strewn with cow pats from the devil's
own satanic herd.
Daniel Foster - daniel@blackomega.com
------------------------------
Date: Thu, 03 Aug 2000 00:17:48 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: day_of_week() and age() without using Date::Calc ?
Message-Id: <3989b90b.626025@news.newsguy.com>
Larry Rosler <lr@hpl.hp.com> wrote:
>Keith Calvert Ivey <kcivey@cpcug.org> says...
>> Bart Lateur <bart.lateur@skynet.be> wrote:
>>
>> > $time = timegm(0, 0, 0, 2, 8-1, 2000);
>>
>> That works, but it's not documented, as far as I know.
>> I'd prefer to show it as
>>
>> $time = timegm(0, 0, 0, 2, 8-1, 2000-1900);
>>
>> to remind people of how gmtime works.
>
>It is, unfortunately, documented, in what I consider to be a total botch
>of the Y2K adjustment. It panders to popular expectations, not to
>logical coherence.
Sorry, I was looking at old docs. It is unfortunate. Perhaps
timegm should accept 12 for the month as meaning December, too.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Wed, 02 Aug 2000 19:15:37 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <brian-ya02408000R0208001915370001@news.panix.com>
In article <8m91q5$1kcn$1@nl.novosoft.ru>, "Konstantin Stupnik" <skv@iis.nsk.su> posted:
> My guess is that it doesn't matter for apache under unix
guesses aren't a good source for information, especially when you
can read the docs and know for sure.
> what extension file have (if it is not explicitly configured
> to handle some extensions in a special way).
> The only thing required is executable permissions.
and various server configurations to allow CGI execution. it's
all about configuration.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Thu, 3 Aug 2000 00:38:57 +0100
From: "Jon Simmons" <unidam@freenetname.co.uk>
Subject: Help with perl please ...
Message-Id: <8mabho$3mk$1@gxsn.com>
Can anyone tell me the best way to store large chunks of html in a file to
be returned to the script at a later date and placed on a returned web page
with other content too. i need this information in order to create a product
database for my site that will have information and other calculated related
links.
Any suggestions are very welcome.
Many thanks, Jon
Jon@trilogy.org.uk
------------------------------
Date: Thu, 3 Aug 2000 00:00:24 +0100
From: "jbr" <jbr@ntlworld.com>
Subject: How do I run CGIs on my desktop?
Message-Id: <NN1i5.1687$ei3.28072@news2-win.server.ntlworld.com>
I'm just a humble html scripter and I started writing CGI scripts, but to
try them out I upload them to my remote web server. This takes a lot of
time because I keep having to alter them and upload them to see if it
worked. So I got a copy of ActivePerl and installed it on my desktop.
But I can't make my locally stored copies of my webpages call my locally
stored CGI scripts. I'd very much value any good advice on how to do
this - it must be simple, if you know how.
------------------------------
Date: Wed, 02 Aug 2000 23:03:04 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: How do I run CGIs on my desktop?
Message-Id: <slrn8ohaeu.9es.marcel@gandalf.local>
On Thu, 3 Aug 2000 00:00:24 +0100, jbr <jbr@ntlworld.com> wrote:
>I'm just a humble html scripter and I started writing CGI scripts, but to
>try them out I upload them to my remote web server. This takes a lot of
>time because I keep having to alter them and upload them to see if it
>worked. So I got a copy of ActivePerl and installed it on my desktop.
>But I can't make my locally stored copies of my webpages call my locally
>stored CGI scripts. I'd very much value any good advice on how to do
>this - it must be simple, if you know how.
You need to set up a web server - Apache is available for Windows as
well. Then you have to configure it to run CGI scripts - but those are
questions for a CGI-related group; they have nothing to do with Perl.
Go to www.apache.org, download it and read the documentation that comes
with it.
Good luck!
--
Marcel
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();
------------------------------
Date: Wed, 02 Aug 2000 15:25:36 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: How to recognize triplicates
Message-Id: <39889FE0.4F5920ED@ipac.caltech.edu>
Abigail wrote:
>
> Tim Conrow (tim@ipac.caltech.edu) wrote on MMDXXVI September MCMXCIII in
>
> $$ [Ugly code deleted - TPC]
> $$ There must be a better way ... ?
>
> Well, you can do that in a single regex:
>
> /(?:^|(.)(?!\1))([^\W_])\2{2}(?!\2)/s;
*That's* the sort of thing I was looking for! I couldn't figure out how
to do that first twiddle, to anchor the match to a char not part of the
triple. I've got to practice my REs more.
--
-- Tim Conrow tim@ipac.caltech.edu 626-395-8435
------------------------------
Date: Thu, 3 Aug 2000 01:54:30 +0100
From: "Phil Latio" <globalcon2isnot@myhouse.com>
Subject: Re: I have an idea but will it work ?
Message-Id: <8mafqr$7tk$1@neptunium.btinternet.com>
Bart Lateur <bart.lateur@skynet.be> wrote in message
news:pt8goskdv0hvkf9ti146u7p70rt5gc43p6@4ax.com...
> Phil Latio wrote:
>
> >Could I create a 5 field flat file database something like below with a line
> >per record and then have a perl script that would search the database on the
> >first 4 fields from the values entered by the customer (look up feature?)
> >and drop in the price automatically.
> >
> >COLOUR,WEIGHT,SIDED,QUANTITY,PRICE
> >white, 80gsm, s/sided, 1000, £40.00
> >white, 80gsm, s/sided, 2500, £75.00
>
> What happens if the customer demands a price for 2000 pages? I'd think
> it should retrieve the next higher number.
>
> --
> Bart.
My idea is to use radio buttons as I only print set quantities.
I am now trying to glue all the replies together to make it work.
I have an example of what I mean at http://www.yorweb.co.uk/orderformtest.html if you care to
comment further. The site is not meant to be public but is just a test bed.
------------------------------
Date: Thu, 3 Aug 2000 01:58:20 +0100
From: "Phil Latio" <globalcon2isnot@myhouse.com>
Subject: Re: I have an idea but will it work ?
Message-Id: <8mag20$81t$1@neptunium.btinternet.com>
Michael Carman <mjcarman@home.com> wrote in message news:398832AB.6AC36DF0@home.com...
> Phil Latio wrote:
> >
> > What is confusing me is this part below.
> >
> > > # This data would come from your form
> > > my $number = 1000;
> > > my $weight = '80gsm';
> > > my $sides = 's/sided';
> > > my $color = 'white';
>
> That's because my example was a quick, command-line one, not CGI. The
> above are the pieces of data that need to come from the HTML form when
> someone clicks the "Submit" button. I just hardcoded values for
> illustration. You should be using the CGI.pm module to get these values,
> as well as for generating the output. (That raw printf() won't cut it
> for CGI.) I'm afraid I can't help you more with this -- I don't do CGI
> programming. You'll need to consult the documentation for CGI.pm. If you
> have command line access to a computer with Perl on it, use perldoc.
> Type
>
> perldoc CGI
>
> at the prompt. Otherwise, go to www.perl.com and search for "CGI.pm"
>
> -mjc
Ahhhh !!! I starting to understand what you mean. Give me a couple of years I might have this
working :-)
------------------------------
Date: Thu, 3 Aug 2000 01:59:48 +0100
From: "Phil Latio" <globalcon2isnot@myhouse.com>
Subject: Re: I have an idea but will it work ?
Message-Id: <8mag4m$inr$1@plutonium.btinternet.com>
Many thanks for all those URL's.
That should keep me out of mischief for while !!
------------------------------
Date: Wed, 02 Aug 2000 22:34:48 GMT
From: "Ben Kennedy" <bkennedy99@home.com>
Subject: Re: killing process 1
Message-Id: <cm1i5.78054$A%3.1081923@news1.rdc2.pa.home.com>
"haggi@work" <haggi@tappe.net> wrote in message
news:39873CBF.7959291E@tappe.net...
> kill KILL, $pid;
is this what you want to be saying? Try using a signal number, like "kill
9, $pid". In general, using "use strict" will catch these errors pretty
quickly. Theres also a Win32::Process module that may be useful for process
manipulation on Win32 systems.
--Ben Kennedy
------------------------------
Date: 02 Aug 2000 17:40:27 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: killing process 1
Message-Id: <87zomv70dg.fsf@limey.hpcc.uh.edu>
>> On Wed, 02 Aug 2000 22:34:48 GMT,
>> "Ben Kennedy" <bkennedy99@home.com> said:
> "haggi@work" <haggi@tappe.net> wrote in message
> news:39873CBF.7959291E@tappe.net...
>> kill KILL, $pid;
> is this what you want to be saying? Try using a signal
> number, like "kill 9, $pid". In general, using "use
> strict" will catch these errors pretty quickly. Theres
> also a Win32::Process module that may be useful for
> process manipulation on Win32 systems.
There's nothing wrong with symbolic signal names:
$ perl -e 'kill TSTP => $$'
[1]+ Stopped perl -e 'kill TSTP => $$'
$
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: 02 Aug 2000 23:09:22 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Need to read a html page and save it via perl Unable to Use LWP
Message-Id: <slrn8ohagk.6n1.abigail@alexandra.foad.org>
ken (kensplace@comport.com) wrote on MMDXXVIII September MCMXCIII in
<URL:news:8m9mlh$ga8$1@news8.svr.pol.co.uk>:
## any suggestions on how to read a url, and save the page to a file
## can be accomplished without the use of the lwp module (virtualave have not
## installed that)
Use Netscape, and hit ALT+S.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
------------------------------
Date: Wed, 02 Aug 2000 17:00:13 -0700
From: Phil Hawkins <tarheel@sierratel.com>
Subject: Newbie needs help.
Message-Id: <3988B60D.51B369A4@sierratel.com>
This is a multi-part message in MIME format.
--------------6FFF746980E63239B9DB26E3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I'm brand new to perl and can't even begin to study the course until I
get this source code thing figured out. How do I download the source
code so I can practice? I went to perl.com to download the code and it
says you have to develop for either Unix or NT. ???
My system is Unix, so I tried to downoad that, and it froze my browser.
I'm dazed and confused. What do I ahve to do to get a workable version
of Perl 5.6.0 so I can begin my lessons? I thought I had it loaded,
but I loaded perl and the DOS screen came on, and I put in "perl -v" and
it crashed and went away. <sigh>
Help! Please?
Phil
PS I'm new to programming too.
--------------6FFF746980E63239B9DB26E3
Content-Type: text/x-vcard; charset=us-ascii;
name="tarheel.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Phil Hawkins
Content-Disposition: attachment;
filename="tarheel.vcf"
begin:vcard
n:Hawkins;Phil
tel;pager:559-437-8951
tel;fax:559-683-4309
x-mozilla-html:FALSE
url:http://website-provisions.com
adr:;;;;;;
version:2.1
email;internet:ph@website-provisions.com
x-mozilla-cpt:;-1
fn:WebSite ProVisions
end:vcard
--------------6FFF746980E63239B9DB26E3--
------------------------------
Date: Wed, 02 Aug 2000 17:02:03 -0700
From: Phil Hawkins <tarheel@sierratel.com>
Subject: Re: Newbie needs help.
Message-Id: <3988B67B.4B0BEBB@sierratel.com>
This is a multi-part message in MIME format.
--------------E03091531F6D8829F03E94F3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
sorry... I screwed up; sent the same message twice.
Phil Hawkins wrote:
> I'm brand new to perl and can't even begin to study the course until I
> get this source code thing figured out. How do I download the source
> code so I can practice? I went to perl.com to download the code and it
> says you have to develop for either Unix or NT. ???
>
> My system is Unix, so I tried to downoad that, and it froze my browser.
> I'm dazed and confused. What do I ahve to do to get a workable version
> of Perl 5.6.0 so I can begin my lessons? I thought I had it loaded,
> but I loaded perl and the DOS screen came on, and I put in "perl -v" and
> it crashed and went away. <sigh>
>
> Help! Please?
>
> Phil
>
> PS I'm new to programming too.
--------------E03091531F6D8829F03E94F3
Content-Type: text/x-vcard; charset=us-ascii;
name="tarheel.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Phil Hawkins
Content-Disposition: attachment;
filename="tarheel.vcf"
begin:vcard
n:Hawkins;Phil
tel;pager:559-437-8951
tel;fax:559-683-4309
x-mozilla-html:FALSE
url:http://website-provisions.com
adr:;;;;;;
version:2.1
email;internet:ph@website-provisions.com
x-mozilla-cpt:;-1
fn:WebSite ProVisions
end:vcard
--------------E03091531F6D8829F03E94F3--
------------------------------
Date: Wed, 02 Aug 2000 17:50:08 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Newbie needs help.
Message-Id: <3988C1C0.6BFC1931@jpl.nasa.gov>
Phil Hawkins wrote:
> sorry... I screwed up; sent the same message twice.
>
> Phil Hawkins wrote:
>
> > I'm brand new to perl and can't even begin to study the course until I
> > get this source code thing figured out. How do I download the source
> > code so I can practice? I went to perl.com to download the code and it
> > says you have to develop for either Unix or NT. ???
> >
> > My system is Unix, so I tried to downoad that, and it froze my browser.
> > I'm dazed and confused. What do I ahve to do to get a workable version
> > of Perl 5.6.0 so I can begin my lessons? I thought I had it loaded,
> > but I loaded perl and the DOS screen came on, and I put in "perl -v" and
> > it crashed and went away. <sigh>
> >
> > Help! Please?
Relax - everything will be alright. First, get perl from
www.activestate.com for your Windows machine. Then, get a DOS window
(Start->Programs->Command Prompt) and try perl -v again.
Jon
--
Knowledge is that which remains when what is
learned is forgotten. - Mr. King
------------------------------
Date: Wed, 02 Aug 2000 22:28:22 GMT
From: "Ben Kennedy" <bkennedy99@home.com>
Subject: Re: Newbie needs memory
Message-Id: <ag1i5.78027$A%3.1081997@news1.rdc2.pa.home.com>
"Anthony Leroy" <aler@etb.bel.alcatel.be> wrote in message
news:3987C38E.370FC2DB@etb.bel.alcatel.be...
> It seems that even a really small one line program as sleep(10); for
> instance takes about 1.8 MB in memory. Why does the perl interpreter
> take so much memory?
All the builtin data types and syntax must be present when the program is
running. A 1.8 meg footprint is ok in the great scheme of things
> I've made a program that looks a little bit like this one:
>
> while (my $line = <MYFILE>)
> {
> ($first,$second,$third) = ($line=~/(\d+) (\d+) (\d+)/);
> @small_array = ($first,$second,$third);
> push (@main_aray,[@small_array]);
> }
>
> This program takes a lot of memory (about 10 MB for a 10000 lines input
> file) but I only push arrays containing 3 integers... What's going on?
> Does Perl allocate a large amount of memory for any array even if it
> contains few elements?
Perl will allocate memory for arrays as needed. If its only a 10000 line
file, it probably loads it pretty quick. Try adding a line
$i++ % 100 or sleep(1);
to slow down the loop - then you can see watch the process size increase
gradually with the data you add to the main array.
--Ben Kennedy
------------------------------
Date: Wed, 02 Aug 2000 19:08:11 -0400
From: zentara <zentara@gypsyfarm.com>
Subject: newbie: multiple file input
Message-Id: <v6ahoskgij19h5c2ncpnlicuc73cnjt3uf@4ax.com>
Hi, I'm trying to learn how to get multiple files in from the @ARGV
array, and load them into individual arrays. As a first step I did:
------------------------------------------------------
#! /usr/bin/perl -w
while (<>){ # read in the files on the command line
push(@out, $_);
}
print "@out \n"; #prints out a concantated file of all input
#files
exit 0;
-------------------------------------------------------
The problem is that this loads all lines into the @out array.
I want to get them into @out1 , @out2, @out3, etc.
My clunky approach follows, but I know there has to be a more elegant
way of doing it. Any pointers? My main roadblock seems to be an
inability to concantate a variable onto the @out array, such as
"@out$a"
to yield @out0 and @out1. Then I could do this in a loop.
I tried to push @out0 and @out1 into another array @output,
but I would only get 1 line each.
My clunky workaround:
------------------------------------------------------
#! /usr/bin/perl -w
$a=0;
open(INFILE, $ARGV[$a]);
while (<INFILE>) { #loads $ARGV[0] into @out0
push (@out0,$_);
}
$a=1;
open(INFILE, $ARGV[$a]);
while (<INFILE>) { #loads $ARGV[1] into @out1
push (@out1,$_);
}
print "@out0\n\n";
print "@out1 \n\n";
exit 0;
-----------------------------------------------------
Thank you.
------------------------------
Date: Wed, 02 Aug 2000 23:15:59 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: newbie: multiple file input
Message-Id: <slrn8ohb82.9es.marcel@gandalf.local>
On Wed, 02 Aug 2000 19:08:11 -0400, zentara <zentara@gypsyfarm.com> wrote:
>Hi, I'm trying to learn how to get multiple files in from the @ARGV
>array, and load them into individual arrays. As a first step I did:
>------------------------------------------------------
>#! /usr/bin/perl -w
>while (<>){ # read in the files on the command line
>push(@out, $_);
>}
>print "@out \n"; #prints out a concantated file of all input
> #files
>exit 0;
>-------------------------------------------------------
>
>The problem is that this loads all lines into the @out array.
>I want to get them into @out1 , @out2, @out3, etc.
Use an array of arrays.
my $out;
for (@ARGV) {
push @$out, [ do { local @ARGV = $_; <> } ];
}
# to visualize the data structure, use:
# use Data::Dumper;
# print Dumper($out);
# to show the first array, use:
# print @{$out->[0]};
--
Marcel
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();
------------------------------
Date: Wed, 02 Aug 2000 15:49:03 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: non-blocking read from fifo
Message-Id: <3988A55F.7C7BA6CB@ipac.caltech.edu>
Kenny Saltiel 5744 wrote:
> I'm trying to obtain the output of three external programs which I
> start-up from within a perl script
> using the Proc::simple module. The external programs write to 3
> named-pipes which I open filehandles for.
> The problem is that since the read from a filehandle blocks while
> waiting for input, I can not read the other fifo's until something comes
> in on the fifo I am waitng on.
>
> Is there anyway I can check the fifo before reading from it?
perldoc -f select
then
perldoc perlfaq5
How can I tell whether there's a character waiting on a
filehandle?
then
perldoc IO::Select
Post again after you've read that and experimented a bit if you don't
get it working.
--
-- Tim Conrow tim@ipac.caltech.edu 626-395-8435
------------------------------
Date: Thu, 03 Aug 2000 00:22:53 GMT
From: j555@my-deja.com
Subject: outputting a CGI script to another frame?
Message-Id: <8mae0o$n06$1@nnrp1.deja.com>
Hi,
I've got a search mechanism in one frame (a form)
and I'd like its output to go to another frame.
Can someone tell me how I go about doing that?
Thanks in advance!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 03 Aug 2000 00:35:27 GMT
From: mikelot@my-deja.com
Subject: Re: Perl CGI - files occasionally truncated
Message-Id: <8maeog$nlo$1@nnrp1.deja.com>
Thanks! That was a real eye opener. I'm going to look into trying out
just what you suggested!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
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 3892
**************************************