[11752] in Perl-Users-Digest
Perl-Users Digest, Issue: 5352 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 11 09:07:30 1999
Date: Sun, 11 Apr 99 06:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 11 Apr 1999 Volume: 8 Number: 5352
Today's topics:
Date/time variable <art@allianceinter.com>
Re: Executing app in win32 (Martin Vorlaender)
file upload with cgi-lib.pl <z2191237@student.unsw.edu.au>
Re: grep -n equivalent? (Bart Lateur)
Re: How do I turn this 1000000 into this 1,000,000 in P (Sam Holden)
Re: How do i write a program that will spell a word eve <boylel@worldnet.att.net>
Re: How do i write a program that will spell a word eve (Tramm Hudson)
Re: Is this patternmatching or what? <urban@spielwiese.de>
keeping reference to local variables??? <leenick@interchange.ubc.ca>
Re: keeping reference to local variables??? (Bart Lateur)
Re: keeping reference to local variables??? <ebohlman@netcom.com>
Re: killing threads in winnt <sugalskd@netserve.ous.edu>
Re: LWP::UserAgent timeout not working? <gisle@aas.no>
Re: MQ Series, C/C++, UNIX, Windows NT -- Southern Cali <bill@fccj.org>
Perl IDE for VI (Aaron)
Re: Perl IDE for VI (Bart Lateur)
Perl v5.14 5.15 dcom and win98 r_i_c@my-dejanews.com
Re: Perl, ran in single-thread mode? <sugalskd@netserve.ous.edu>
Re: pragma - relevant? (Sam Holden)
Re: question about hash keys <vvb@ibm.net>
Re: stumped on regex - onto array <ericsm@iafrica.com>
Re: Threading in Perl <sugalskd@netserve.ous.edu>
using perl to load a web page (Pete)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 11 Apr 1999 02:25:23 -0500
From: Art Gratchev <art@allianceinter.com>
Subject: Date/time variable
Message-Id: <37104E63.D2B5B3C3@allianceinter.com>
Is there any way to get a system date and time in perl CGI? Like a
environment variable or something..
Anybody..anybody?
Thanks in advance,
-Art.
------------------------------
Date: Sun, 11 Apr 1999 14:06:06 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Executing app in win32
Message-Id: <3710902e.524144494f47414741@radiogaga.harz.de>
cwidhelm@arcmail.com wrote:
: I am in the process of writing a cgi that when invoked will launch an
: application on the server side to perform an operation. I am sending a system
: call as follows
:
: system( '<path><application name><application parameters>' );
:
: After sending the system call the browser just hangs. Any suggestions on how
: to remedy this problem?
I bet you're using IIS instead of a real webserver. IIS' I/O redirection
is broken, leading to effects like these.
IIS 3.0
=======
In the registry, insert into the hive
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\
CreateProcessWithNewConsole , contents REG_DWORD 1
and restart IIS.
IIS4.0
======
- Make sure that you've got Windows Scripting Host installed as part
of Option Pack 4. You can verify this by looking for the file
%system32%\cscript.exe. If it isn't there, run setup.exe from
the Option Pack CD-ROM and install it.
- Using the CLI, go to %system32%\inetsrv\adminsamples.
- Run this:
adsutil.vbs SET W3SVC/1/CreateCGIWithNewConsole 1
(the number after "W3SVC/" may vary if you have multiple websites.
If you have, repeat the procedure for all websites.)
It'll say that CScript isn't set up to handle this. That's ok.
- Click Ok.
- Click yes, you want to register.
- Run it again.
- Using the ISM, restart all web sites.
Hope it helps,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
VMS is today what | work: mv@pdv-systeme.de
Microsoft wants | http://www.pdv-systeme.de/users/martinv/
Windows NT 8.0 to be! | home: martin@radiogaga.harz.de
------------------------------
Date: Sun, 11 Apr 1999 22:39:05 +1000
From: Chris Clark <z2191237@student.unsw.edu.au>
Subject: file upload with cgi-lib.pl
Message-Id: <371097E8.6ACA33A4@student.unsw.edu.au>
I am having great difficulties in working out how to use cgi-lib.pl to
do File Uploading. I have put together the following script based the
documentation for cgi-lib.pl however I am unsure as to where exactly
these files are ending up, if they are actually being saved anywhere at
all. Do I have to print the data out somewhere? If so, how? Any help
would be excellent!
Tia, Chris Clark.
********
#!/opt/local/bin/perl
require 'cgi-lib.pl';
&ReadParse(*input);
print &PrintHeader;
my (%cgi_data, # The form data
%cgi_cfn, # The uploaded file(s) client-provided name(s)
%cgi_ct, # The uploaded file(s) content-type(s). These are
# set by the user's browser and may be unreliable
%cgi_sfn, # The uploaded file(s) name(s) on the server (this
machine)
$ret, # Return value of the ReadParse call.
$buf # Buffer for data read from disk.
);
# When writing files, several options can be set..
# Spool the files to the /tmp directory
$cgi_lib::writefiles = "/tmp";
# Limit upload size to avoid using too much memory
$cgi_lib::maxdata = 50000;
# Start off by reading and parsing the data. Save the return value.
# Pass references to retreive the data, the filenames, and the
content-type
$ret = &ReadParse(\%cgi_data,\%cgi_cfn,\%cgi_ct,\%cgi_sfn);
print "done!";
************
------------------------------
Date: Sun, 11 Apr 1999 09:52:50 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: grep -n equivalent?
Message-Id: <37116f5b.3457583@news.skynet.be>
Ran wrote:
>I've already figured out a different way to do this (that's probably
>even a better one for this particular application), but it it occurred
>to me that it would be an extremely nifty way of doing "fuzzy" table
>lookups (particularly when there's likely to be more than one match):
>an option/variant of the grep function that returned the indices of the
>matched list elements, instead of the elements, themselves.
I hope I understood you correctly.
If you remember the possibility to emulate grep using map alone:
grep { COND } LIST
<->
map { COND? $_ : () } LIST
(replacing COND and LIST with what you really want) than this can be
done somewhat like this:
my $i = -1;
@index = map { $i++; COND ?$i:() } LIST;
(although personally I don't like the dependency of the result on the
execution order inside the map()).
Bart.
------------------------------
Date: 11 Apr 1999 10:04:09 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: How do I turn this 1000000 into this 1,000,000 in Perl?
Message-Id: <slrn7h0ssp.phc.sholden@pgrad.cs.usyd.edu.au>
On Sat, 10 Apr 1999 03:41:05 GMT, ggveiga@my-dejanews.com wrote:
>In article <x7pv5esag5.fsf@home.sysarch.com>,
>
>>
>> for the correct answer, see perlfaq5, How can I output my numbers with
>> commas added?
>
>Even the faq answer is a bit of a poorman's solution to the problem. For an
>approach that takes care of most of details, use module Format::Number
>(available from CPAN). For instance, it will use your locale's thousand
>separator and decimal point characters.
But the question was how to add commas?
Maybe the locale doesn't use commas, but some input format of
something else does?
Highly unlikely of course... ;)
--
Sam
If your language is flexible and forgiving enough, you can prototype
your belief system without too many core dumps.
--Larry Wall
------------------------------
Date: Sun, 11 Apr 1999 00:32:55 -0700
From: Lee Boyle <boylel@worldnet.att.net>
Subject: Re: How do i write a program that will spell a word every way possible?
Message-Id: <37105027.7FAAE12D@worldnet.att.net>
Scott Porter wrote:
>
> On Sat, 10 Apr 1999 12:31:39 -0600, Collin Starkweather <collin.starkweather@colorado.edu> wrote:
>
> [...]
>
> >The trick is to write a perl script that will write the above logic in
> >the form of a perl script for a string of arbitrary length.
>
> Yes, I can see how the logic works in that example. As you say
> though, the method for handling randomly sized words would
> differ from the above. For instance, building a function that
> could be passed a string, and output every possible mixture
> of characters into an array. I'm sure some clever sod will come
> up with a 3 line script to handle anything though :)
Here's a recursive solution off the top of my head. Don't try it
with more than 8 characters unless you've got some time to kill.
The basic idea is that to list all the permutations, you just loop
through the word selecting each character in turn to be the first
one, and print that character followed by each permutation of the
remaining characters:
<HTML>
<HEAD>
<SCRIPT language="JavaScript1.2">
function permute(word) {
if(word.length==1) {
return new Array(word);
}
var retval=new Array();
retval.length=0;
for(var i=0;i<word.length;i++) {
var
recurse=permute(word.substr(0,i)+word.substr(i+1,word.length));
for(var j=0;j<recurse.length;j++) {
retval[retval.length++]=word.charAt(i)+recurse[j];
}
}
return retval;
}
function show_permutations(word) {
var result=permute(word);
var w=window.open("","permute");
w.document.open();
w.document.writeln("<PRE>");
for(var i=0;i<result.length;i++) {
w.document.writeln(result[i]);
}
w.document.writeln("</PRE>");
w.document.close();
}
</SCRIPT>
</HEAD>
<BODY>
<FORM ONSUBMIT="show_permutations(word.value);return false">
<INPUT NAME="word">
</FORM>
</BODY>
</HTML>
------------------------------
Date: 11 Apr 1999 00:51:27 -0600
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: How do i write a program that will spell a word every way possible?
Message-Id: <7epgpf$qrv@llama.swcp.com>
[cc'd to cited author, but what does this have to do with JavaScript?]
In article <370feb57.311017@news.demon.co.uk>,
Scott Porter <scott@quick-silver.demon.co.uk> wrote:
[snip...]
>Yes, I can see how the logic works in that example. As you say
>though, the method for handling randomly sized words would
>differ from the above. For instance, building a function that
>could be passed a string, and output every possible mixture
>of characters into an array.
Why muck about with building a new perl script or passing around
functions when simple recursion provides the tools needed?
So we need to permute things. What does that mean? We iterate
through the list of elements and for each element, compute the
permutation of the remaining elements. Sounds like a standard
recursive definition, so we just need a bottom case -- a one
element list is its own permutation.
Now this assumes that the elements are distinct. The string aa
has two permutations 'aa' and 'aa'. But I might have those in
the wrong order.
Now if perl supported tail recursion, I would have written this to
be properly tail recursive. But since this is not scheme, I've
just let it built a massive set of stack frames. Don't call it with
too long of an argument or be prepared for some heavy pagin.
And remember that a string of length n has n! permutations...
> I'm sure some clever sod will come
>up with a 3 line script to handle anything though :)
Arrgh! I hate being called a sod. Stupid git. Besides, it
is five lines of code, but would easily fit onto two.
#!/usr/bin/perl -w
use strict;
sub perm
{
return ($_[0]) if @_ == 1;
map {
my $i = $_;
map { $_[$i].$_ } perm( @_[0..$_-1 , $_+1..$#_] );
} (0..$#_);
}
for( @ARGV ) {
for( perm( split // ) ) {
print "$_\n";
}
}
__END__
So invoked as:
% ./perm perm | paste - - - - - -
perm pemr prem prme pmer pmre
eprm epmr erpm ermp empr emrp
rpem rpme repm remp rmpe rmep
mper mpre mepr merp mrpe mrep
Tramm
--
o hudson@swcp.com tbhudso@cs.sandia.gov O___|
/|\ http://www.swcp.com/~hudson/ H 505.266.59.96 /\ \_
<< KC5RNF @ N5YYF.NM.AMPR.ORG W 505.284.24.32 \ \/\_\
0 U \_ |
------------------------------
Date: Sat, 10 Apr 1999 19:32:27 +0200
From: Rob Urban <urban@spielwiese.de>
Subject: Re: Is this patternmatching or what?
Message-Id: <370F8B2B.3486E06E@spielwiese.de>
IMHO, you should be more clear in your criticism to differentiate
between errors and stylistic recommendations. The author of the basenote
is obviously new to perl and it may not be immediately clear to her from
which of your comments point to real errors and which are just helpful
hints.
my $0.02.
Rob Urban
Tad McClellan wrote:
>
> Annica Johansson (nca@tek.edu.jonkoping.se) wrote:
> : I'm trying to figure out how to get the script to search for a word given to
> : the script by the keyboard... Not only do I want the script to search for
> : that particular word, but I also want it to only search the first word on
> : every line.
> : Could anyone help me and tell me were I went wrong?
>
> You went wrong in numerous places.
>
> : $file = '<C:\perl\mitt\test2.txt';
> : open(INFO, $file);
>
> What will your program do if the open() should happen to fail?
> (file doesn't exist, permission denied...)
>
> A: It will make garbage output
>
> What should it do instead if it cannot open() the file?
>
> Probably just give up and stop execution.
>
> The usual "give up" idiom in Perl is:
>
> open(INFO, $file) || die "could not open '$file' $!";
>
> That is, you should *always* check the return value from open()
>
>
> : @lines = <INFO>;
>
> Since you are finished with the INFO filehandle here, you
> should close it.
>
> Perl will close it for you when it exits, but it is safer to
> always close. (It cost me 6 hours of troubleshooting once.
> I learned my lesson: always do an explicit close())
>
> : print "Enter a word to search for:";
>
> You should use single quotes if you do not need variable
> interpolation or backslash escapes:
>
> print 'Enter a word to search for:';
>
> : $a = <STDIN>;
>
> There is a newline on the end of $a, best remove that unless
> you are searching for a word at the end of the line.
>
> chomp $a;
>
> ( $a (and $b) are "special" in Perl. They are used for sorting.
>
> You can sometimes get strange results if you use them for
> your own purposes.
>
> But that hardly matters, since nobody would use an
> undescribed single letter variable name.
>
> Instead they would chose a name that indicates what the
> variable is meant to contain.
>
> e.g. instead of using a mysterious $a, they would use
> something like $word or $user_input or something :-)
> )
>
> : while (<@lines>) {
>
> That line is all out of whack.
>
> The <angle brackets> are an input operator, so perl will try
> to do input here.
>
> You have already done all of the input you need to do. I think
> you are trying to "walk" over all of the elements (lines) of
> the @lines array.
>
> You do that like this:
>
> foreach (@lines) { # perl puts each line, into the $_ variable
>
> or
>
> foreach $line (@lines) { # perl puts each line, into the $line variable
>
> : @lines = $f;
>
> I don't know what you were hoping for that statement to do.
>
> You should *always* enable warnings from perl. It will catch
> many of your mistakes for you.
>
> You should also use the 'use strict' pragma and declare all of
> your variables too, for the same reason.
>
> Start with this and experiment with it:
>
> ----------------------
> #!/usr/bin/perl -w
> use strict;
>
> my $file = 'data';
> open(INFO, $file) || die "could not open '$file' $!";
> my @lines = <INFO>;
> close(INFO);
>
> print 'Enter a word to search for: ';
> my $search_word = <STDIN>;
> chomp $search_word;
>
> foreach my $line (@lines) {
> print $line if $line =~ /^$search_word/;
> }
>
> #print grep /^$search_word/, @lines; # replace the 3 lines above with 1 line
> ----------------------
>
> Note that Perl has a grep() function specifically made for
> searching in an array.
>
> --
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Sun, 11 Apr 1999 02:44:34 -0700
From: Nick Lee <leenick@interchange.ubc.ca>
Subject: keeping reference to local variables???
Message-Id: <37106F02.DCF8515B@interchange.ubc.ca>
Hi,
I just have a small question .... In C/C++, we are not supposed to
keep a pointer or reference to local variables because their memory
locations would not be valid after the function has exited. Do I have
to worry about this in Perl? For example, I have the following code:
sub func
{
my ($hashRef) = @_;
my (@localArray);
@localArray = (1 2 3 4 5);
$hashRef->{'array'} = \@localArray;
}
$hashRef will hold a reference to @localArray after the function is
done. Would it cause any problem like in C/C++???
I've tried some functions having similar stuff and it shows no problem
so far. But this kind of memory problem may not show up in small
program anyway. So I just want to make sure.
Thanks a lot.
------------------------------
Date: Sun, 11 Apr 1999 10:10:39 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: keeping reference to local variables???
Message-Id: <371473bc.4578548@news.skynet.be>
Nick Lee wrote:
>keep a pointer or reference to local variables because their memory
>locations would not be valid after the function has exited. Do I have
>to worry about this in Perl? For example, I have the following code:
>
>sub func
>{
> my ($hashRef) = @_;
> my (@localArray);
>
> @localArray = (1 2 3 4 5);
> $hashRef->{'array'} = \@localArray;
>}
Those are not local(), those are my()'ed. A big difference in behaviour.
>$hashRef will hold a reference to @localArray after the function is
>done. Would it cause any problem like in C/C++???
No. Perl uses a different garbage collection mechanism: Perl uses
reference counting. All that happens is that the reference through the
local (my'ed) variable itself disappears. Since you're keeping a (at
least one) reference to this allocated memory block, the block won't be
freed, at least, not until you release that reference.
It's a very powerful mechanism. The only thing to be afraid of is
circular references. (A contains a reference to B, and vice versa. In
that case, A and B will never be released, even if they're no longer
accessible for the rest of the world.)
>I've tried some functions having similar stuff and it shows no problem
>so far. But this kind of memory problem may not show up in small
>program anyway. So I just want to make sure.
You can rely on it.
Bart.
------------------------------
Date: Sun, 11 Apr 1999 10:10:28 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: keeping reference to local variables???
Message-Id: <ebohlmanFA0s9G.5Fq@netcom.com>
Nick Lee <leenick@interchange.ubc.ca> wrote:
: I just have a small question .... In C/C++, we are not supposed to
: keep a pointer or reference to local variables because their memory
: locations would not be valid after the function has exited. Do I have
: to worry about this in Perl? For example, I have the following code:
No, you don't have to worry about this. Perl maintains reference counts
for all variables, and won't release a variable with a non-zero count.
------------------------------
Date: 11 Apr 1999 05:57:02 GMT
From: Dan Sugalski <sugalskd@netserve.ous.edu>
Subject: Re: killing threads in winnt
Message-Id: <7epdje$kd6$2@news.NERO.NET>
Ulas Kirazci <ukirazci@fore.com> wrote:
: hi. i just started playing around with the Thread module (under winnt). i
: am using it to make non-blocking read's from a process started with
: "open2", since alarms and select aren't fully implemented in winnt to my
: knowledge.
: the problem is that, i also need to kill threads that i have decided to
: abandon. is there any way to do this?
Nope. And there probably won't ever be a truly safe way to do this within
perl. On many platforms perl uses POSIX threads, and just up and stopping
one of them (safely) isn't simple. (I'm not 100% sure it's possible, but
even if it is it definitely won't be simple)
There might be something in 5.006, if time permits.
Dan
------------------------------
Date: 10 Apr 1999 20:38:35 +0200
From: Gisle Aas <gisle@aas.no>
Subject: Re: LWP::UserAgent timeout not working?
Message-Id: <m3aewg7238.fsf@eik.g.aas.no>
dwilgaREMOVE@mtholyoke.edu (Dan Wilga) writes:
> I just installed libwww-perl-5.42 and am having problems with
> LWP::UserAgent taking far too long to timeout for a host that is not
> responding. Instead of taking the 15 seconds I'm asking it to, it takes
> about 13 minutes. I tested this URL with Netscape, and it took the
> customary couple of minutes to timeout.
>
> I am also using HTML-Parser-2.22, MIME-Base64-2.11, URI-1.02, and
> libnet-1.0606. This is a Linux machine running Perl 5.005_02.
Try upgrading the IO modules.
> Here is a sample:
>
> use LWP::UserAgent;
> use HTTP::Request;
>
> my $ua = new LWP::UserAgent;
> $ua->timeout(15); # 15 seconds
>
> my $req = new HTTP::Request 'HEAD' =>
> 'http://falcon.eku.edu/honors/beyond-mla/';
> my $res = $ua->request($req);
> print "Got ".$res->status_line."\n";
--
Gisle Aas
------------------------------
Date: Sat, 10 Apr 1999 10:48:10 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: MQ Series, C/C++, UNIX, Windows NT -- Southern California Talent Search
Message-Id: <370f64d8.0@usenet.fccj.cc.fl.us>
In article <370E8A38.88BB4AEB@giss.nasa.gov>, Jay Glascoe
<jglascoe@giss.nasa.gov> wrote:
> grep -i perl < karynelk_wrote | wc
> 0 0 0
>
> Jay Glascoe
:]
I've always thought using MQ Series would
fry one's I/O ports...
-Bill Jones- :]
______________________________________________________
"Never Mind" -- I'll improvise, adapt, and overcome;
everything else will be deleted.
Jacksonville Perl Mongers
http://jacksonville.pm.org
jax@jacksonville.pm.org
------------------------------
Date: Sun, 11 Apr 1999 02:33:07 -0500 (CDT)
From: aaron@soltec.net (Aaron)
Subject: Perl IDE for VI
Message-Id: <Pine.LNX.4.04.9904110232130.20923-100000@localhost.pants.org>
I saw that someone posted that EMACS was a good ide for perl
but is there an equivalent for VIm
I've used perlbuilder on win32 to write perl
and it has some nice features
but it would be great to have VI as the editor
Aaron
-----
Have you ever had a twenty minute trip?
-Avi
------------------------------
Date: Sun, 11 Apr 1999 09:55:02 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl IDE for VI
Message-Id: <37127108.3887481@news.skynet.be>
Aaron wrote:
>I saw that someone posted that EMACS was a good ide for perl
>but is there an equivalent for VIm
>
>I've used perlbuilder on win32 to write perl
>and it has some nice features
>but it would be great to have VI as the editor
Have your checked the "editors" section on www.perl.com ? It has two
pointers, one to the VIM page, and one to a Win32-editors page.
HTH,
Bart.
------------------------------
Date: Sun, 11 Apr 1999 11:48:29 GMT
From: r_i_c@my-dejanews.com
Subject: Perl v5.14 5.15 dcom and win98
Message-Id: <7eq26c$cmr$1@nnrp1.dejanews.com>
Upon trying to upgrade to v5.14 or 5.15 of activestate
perl, i am told dcom is required. I am running win98
with IE5. I know win98 *should* not require dcom, is
there a switch that will disable this dcom check?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 11 Apr 1999 05:58:52 GMT
From: Dan Sugalski <sugalskd@netserve.ous.edu>
Subject: Re: Perl, ran in single-thread mode?
Message-Id: <7epdms$kd6$3@news.NERO.NET>
Darren Greer <drgreer@qtiworld.com> wrote:
: Howdy all.
: I believe a problem I am having with the DBD and DBI modules, is due
: to perl and threading. If I compile perl with threading enabled, will
: it try to run a program thread autmatically?
Nope. Threaded perl does behave a little differently than non-threaded
perl (@_ and $_ are lexical), but not by much.
What sorts of problems are you having?
Dan
------------------------------
Date: 11 Apr 1999 11:33:31 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: pragma - relevant?
Message-Id: <slrn7h124b.s9v.sholden@pgrad.cs.usyd.edu.au>
On Sat, 10 Apr 1999 01:43:46 -0400, JTJ <elssa09@callisto.si.usherb.ca> wrote:
>Relevant?
>
>Who wrote the rules on what little idiosyncracy I could not post?
I think it's just general courtesy to ask perl questions
in perl newsgroups, and web browser/server questions in
web browser/server newsgroups.
>
>Look - I'm no newbie, just that this Pragma thing is getting on my
>nerves. Yes it's a browser stupidity. But I'm trying to make a
>"""PERL""" script work.
I never called you a newbie, then again I guess someone else
may have...
>
>That's why I came here ... fellow programmers helping fellows ... not to
>get flamed.
>
>Sam: I have answered your queries from time to time. Now I'm looking for
>an answer to a question.
Was that question about perl by chance?
>
>We all use "Content-Type: text/html" from time to time, don't we?
No.
>Has anyone had any problems/experience with "Pragma: no-cache"?
Probably but many of them probably weren't using perl at the
time, and don't read clpm...
In a newsgroup specifically about the area that the problem is
in someone who knows the answer would be much easier to find.
Common sense really...
>
>Does anyone know where I might look for a little help on my Pragma prob?
A newsgroup related to web stuff... They have been posted numerous
times...
>
>news:370D8EEE.537C@callisto.si.usherb.ca
>
>Is there a FAQ someplace that I overlooked?
Possibly in a group that actually deals with the topic area.
>Does the problem sound familiar?
Not to me, but I don't use anything vaguely like Pragma stuff
as with most people who read this group I would assume...
>Can someone offer a little help?
I'm sure someone can, they probably read a different newsgroup though,
and thus didn't see your question.
--
Sam
I explicitly give people the freedom not to use Perl, just as God gives
people the freedom to go to the devil if they so choose.
--Larry Wall
------------------------------
Date: Sun, 11 Apr 1999 12:56:48 +0200
From: "Vincent Vanbiervliet" <vvb@ibm.net>
Subject: Re: question about hash keys
Message-Id: <37107fcd@news.uk.ibm.net>
Yes there is...:-)
If you try
print "$h{123} $h{'123'}";
the output will be
c c
The reason is that whatever is between the { and } can be written with or
without the quotes, it is always interpreted as quoted.
Thus, as a key, both 123 and '123' are regarded the same, so on line 3 you
modify the value you defined on line 1.
Just read the camel for more details.
Boson wrote in message <370e284b.97821872@news.earthlink.net>...
>I have been experimenting with the hash keys...I don't understand why
>this little code prints out "b c". I was expecting "a b c" or maybe
>just "c".
>
>$h{123} = 'a';
>$h{'0123'} = 'b';
>$h{'123'} = 'c';
>print "$h{$_} " foreach (keys %h);
>
>I am sure there is a simply explanation. Help!
>
>Boson
>
>
------------------------------
Date: 11 Apr 1999 11:09:23 GMT
From: "Eric Smythe" <ericsm@iafrica.com>
Subject: Re: stumped on regex - onto array
Message-Id: <01be840b$b52a2f60$1c0d1fc4@snow.fruitcom>
Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote in article
<1dpyxux.6jxbvr1j54961N@p120.block2.tc2.state.ma.tiac.com>...
> Eric Smythe <ericsm@iafrica.com> wrote:
>
> > Let us look more closely at those rules.
> >
>
> According to your rules, the weight is also a price. How should that be
> dealt with?
>
> > ---AVOCADOS: 4 kg cntrs IS Hass 18s 7.14 Reed 12s 7.41-8.51
My rules were to general Uri defined an obligatory `.' and that sorts out
the weights.
So the regex below is perfect:
#!/usr/bin/perl -w
$/ = undef ;
$text = <STDIN> ;
while( $text =~ m[
( # main grab
\d{0,2} # 0-2 digits
\. # required .
\d\d # required 2 digits
(?: # group the second part
- # required - separator
\d{0,2} # 0-2 digits
\. # required .
\d\d # required 2 digits
)? # optional second price
) # main grab
\b # boundary (not really needed)
]gx) { # global and extended
print "The string is: $1\n";
}
I would really appreciate som more help though.
I need to parse the input into arrays - so
@array=($stringA, $priceA, $stringB, $priceB, \
$stringC, $prineB ...$priceN)
.. where $stringX is the stuff inbetween the two prices.
How would I set a routine to incorporate the regex above and do that?
Thanx
Here is a slice of (<INPUT>)
---LEMONS: 15-16 kg cntrs SP Class I 90s 9.33-10.43 100s 10.15-10.98 120s
10.15-10.98 140s 9.88
---MISC CITRUS: ctns MR Clementine Ortanique 60s 7.41-8.51 75s 8.78-9.33
90s
10.43-11.53 108s 10.43-11.53 SP Clementine 60s 12.08-13.17 80s
12.08-13.17
---APPLES: per kg FR CLASS I Golden Delicious 70-75mm .77-.88 75-80mm
88-.99
Granny Smith 75-80mm .77-.93 GM CLASS I Jonagold 70-80mm .52-.60 80-90mm
.52-.60 Elstar 65-70mm .71-.85 Cox Orange 65-70mm .36-.38 70-80mm
77-.82
IT CLASS I Golden Delicious 70-75mm .66-.69 75-80mm .66-.80 Granny Smith
70-80mm .66-.80 Braeburns 70-75mm 1.18-1.29 75-80mm 1.18-1.29 12.5 kg
cntrs
US Pink Lady 64s 18.11-21.96 72s 18.11-21.96 80s 18.11-21.96 18 kg cntrs
FR
CLASS I Golden Delicious 88s 13.17-15.37 100s 13.17-15.37 113s
13.17-15.37
Granny Smith 88s 13.17-14.27 100s 13.17-14.27 113s 13.17-14.27
---AVOCADOS: 4 kg cntrs IS Hass 18s 7.14 Reed 12s 7.41-8.51 18s 7.14-7.41
KE
---PEARS: per kg NL Conference .88-.93 12.5 kg cntrs CL Packham Triumph
90s
12.08-13.17 SF Packham Triumph 96s 10.43-11.53 15 kg cntrs CL Red
Sensation
80s 9.74-10.98 18 kg cntrs AG Williams 110s 15.37-18.11
---PINEAPPLES: ctns 1 lyr CR 5s 7.96-8.78 fine qual 18.11-19.76 8s
8.51-9.33
fine qual 18.11-19.76 9s fine qual 17.02-18.11
---PLUMS: 5 kg cntrs CL Angeleno 7.68-8.23 5.25 kg cntrs SF Songold
6.59-8.23
Kessleman 6.04-6.59
------------------------------
Date: 11 Apr 1999 05:51:46 GMT
From: Dan Sugalski <sugalskd@netserve.ous.edu>
Subject: Re: Threading in Perl
Message-Id: <7epd9i$kd6$1@news.NERO.NET>
Swaminathan Balasubramanian <swamib@netscape.com> wrote:
: Where can i find info about doing Multi-threading in Perl ?
The docs for the Thread module are a good place to start. If you've got
5.005_03 (which you should if you want to play with threads) then you can
also try the perlthrtut docs that come with it. There's not much beyond
source-diving after that.
Dan
------------------------------
Date: 11 Apr 1999 10:52:48 GMT
From: psalzman@landau.ucdavis.edu (Pete)
Subject: using perl to load a web page
Message-Id: <7epuu0$n2i$1@mark.ucdavis.edu>
sorry if this rambles, but i've stayed up waaay past my bedtime...
i'm trying to use perl to run lynx.
i'd like to load up a page, say,
http://landau.ucdavis.edu/psalzman/version.html
read the entire content into a variable, say,
$output
and kill lynx once the entire page is read in. here's my unsuccessful attempt:
sub GetVersion {
print "GetVersion is running\n";
open ( PAGE, "lynx http://landau.ucdavis.edu/psalzman/version.html|" );
while ( <PAGE> ) {
$output=$_;
print "*$output*";
}
close (PAGE);
}
can someone tell me the correct way of doing something like this? i tried
looking at weblint, but i'm a perl newbie and it's hard to follow (i
noticed that although perl is a FANTASTIC language, it's a bit harder to
read than the average language...)
thanks!
pete
--
NEWS FLASH: Just compiled a new kernel 2.2.4! YEAH!!!
----------------------------------------------------------------
http://landau.ucdavis.edu/psalzman psalzman@landau.ucdavis.edu
One world, one web, one program. -- Microsoft Ad Campaign
Ein Volk, ein Reich, ein Fuhrer. -- Nazi Ad Campaign
<=>+/\/-=Prevent world domination, Install Linux today!=-\/\+<=>
----------------------------------------------------------------
The best way to accelerate a win95 system is at 9.81 m/s^2
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5352
**************************************