[13827] in Perl-Users-Digest
Perl-Users Digest, Issue: 1237 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 31 12:05:31 1999
Date: Sun, 31 Oct 1999 09:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <941389510-v9-i1237@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 31 Oct 1999 Volume: 9 Number: 1237
Today's topics:
Re: adding data to beginning of file <gellyfish@gellyfish.com>
Re: CGI won't return text field info?? (David Efflandt)
Comparing Arrays (short question) (Pfash1)
Re: Comparing Arrays (short question) <bwalton@rochester.rr.com>
Re: Comparing Arrays (short question) <ltl@rgsun40.viasystems.com>
Re: comparing text with words (Abigail)
Re: crypt() (David Efflandt)
Re: Difference btw PerlDBD and DBD::Oracle <gellyfish@gellyfish.com>
Easy question about $FORM{'data'} variables <mjh@me.com>
Re: Easy question about $FORM{'data'} variables <kbandes@home.com>
Re: Func works first time but not second <nobody@nowhere.net>
Re: help with Text:ParseWords <kbandes@home.com>
Re: It is always like this here? (Mark W. Schumann)
MacPerl 5 assign to Listelement <hartje@etech.hs-bremen.de>
Re: Need cgi script <gellyfish@gellyfish.com>
Re: Need help with error. Thanks! <claire@telix.com>
Re: Need help with error. Thanks! <kbandes@home.com>
Re: Need help with error. Thanks! <gellyfish@gellyfish.com>
Re: New win32 module volInfo: have I got it right? <gellyfish@gellyfish.com>
Re: perl double-split <ltl@rgsun40.viasystems.com>
Re: Perl script to compile C program. <gellyfish@gellyfish.com>
quick question (I hope) <tech1@magicnet.net>
Re: quick question (I hope) <flavell@mail.cern.ch>
Re: Sub in which module <gellyfish@gellyfish.com>
Re: Telnet Question <jkuhnert@bellatlantic.net>
Re: use heredoc to assign var? <r28629@email.sps.mot.com>
What is "interpolation"? <garcia868@yahoo.com>
Re: What is "interpolation"? <bwalton@rochester.rr.com>
Re: What is "interpolation"? <ltl@rgsun40.viasystems.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 31 Oct 1999 14:11:04 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: adding data to beginning of file
Message-Id: <7vhilo$1kc$1@gellyfish.btinternet.com>
On Thu, 28 Oct 1999 14:22:22 -0400 Ala Qumsieh wrote:
>
> Aaron Walker <amwalker@gate.net> writes:
>
>> --
>
> The above line usually indicates that everything below it part of the
> signature. It caused my newsreader to treat the rest of your post as a
> signature. It's not harmful, but try to avoid that please.
>
It might be inconvenient however with a newsreader that would remove
a signature from the quoted text when replying if one wanted to refer
to the material below ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 31 Oct 1999 16:24:18 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: CGI won't return text field info??
Message-Id: <slrn81or9h.23e.efflandt@efflandt.xnet.com>
On Tue, 26 Oct 1999 19:09:28 GMT, sleepernyc@my-deja.com
<sleepernyc@my-deja.com> wrote:
>I've got a fairly tight survey form on my sight , but can't seem to
>make my Comments: field to return text to my form.log
>
>Any ideas?
>
>I'm using
>
>If you have any other comments or suggestions for us, please feel free
>to enter them here:<BR>
><textarea name="textfield" row="4" cols="50">Comments:</textarea>
>
>and in my data_order = (name,address,submit_by,textfield)
If you are using CGI.pm, 'textfield' is a reserved word that is used to
create an input field of type=text. Maybe that is tripping you up. Try
changing the name of the field.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
http://thunder.prohosting.com/~cv-elgin/
------------------------------
Date: 31 Oct 1999 15:01:02 GMT
From: pfash1@aol.com (Pfash1)
Subject: Comparing Arrays (short question)
Message-Id: <19991031100102.02949.00001075@ng-cg1.aol.com>
#!perl -w
Here is my problem. Any help is greatly appreciated: I want to compare these
two arrays. (the real application involves an unknown number of strings that
need to be pushed into arrays under three hash keys)
push @arrayone, { one=> 'A', two => 'B', three => 'C'};
push @arraytwo, { four=> 'A', five => 'B', six => 'D'};
foreach(@arraytwo)
{
if( $_->{four} eq $_->{one}) #How should I write this?
{
print $_->{five} #here I want to get "D"
}
}
Thanks in advance,
pfash@umich.edu
------------------------------
Date: Sun, 31 Oct 1999 10:40:11 -0500
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Comparing Arrays (short question)
Message-Id: <381C62DB.85827BB2@rochester.rr.com>
Pfash1 wrote:
>
> #!perl -w
>
> Here is my problem. Any help is greatly appreciated: I want to compare these
> two arrays. (the real application involves an unknown number of strings that
> need to be pushed into arrays under three hash keys)
>
> push @arrayone, { one=> 'A', two => 'B', three => 'C'};
Hmm...@arrayone has one element, a reference to an anonymous hash.
> push @arraytwo, { four=> 'A', five => 'B', six => 'D'};
@arraytwo has one element, also a reference to an anonymous hash.
> foreach(@arraytwo)
> {
Now $_ holds a reference to an anonymous hash (the arraytwo one)
> if( $_->{four} eq $_->{one}) #How should I write this?
Now you look up $_->{four}, which is 'A' and $_->{one}, which is undef.
That is almost certainly not what you want to do. The key 'one' is
defined in the arrayone hash.
> {
> print $_->{five} #here I want to get "D"
That would, if it were executed (which it isn't) generate 'B', not 'D'.
> }
> }
>
> Thanks in advance,
> pfash@umich.edu
If you could define clearly exactly what it is you want to
accomplish, perhaps someone could help you. Based on the
description in your note, I don't know what it is you actually
want to do. Maybe what you want is something like:
push @arrayone, { one=> 'A', two => 'B', three => 'C'};
push @arraytwo, { four=> 'A', five => 'B', six => 'D'};
for(my $i=0;$i<=$#arrayone;$i++)
{
if( $arraytwo[$i]->{four} eq $arrayone[$i]->{one}) #How
should I write this?
{
print $arraytwo[$i]->{six} #here
I want to get "D"
}
}
--
Bob Walton
------------------------------
Date: 31 Oct 1999 15:59:22 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: Comparing Arrays (short question)
Message-Id: <7vhp0q$2fj$1@rguxd.viasystems.com>
Pfash1 <pfash1@aol.com> wrote:
:>#!perl -w
:>Here is my problem. Any help is greatly appreciated: I want to compare these
:>two arrays. (the real application involves an unknown number of strings that
:>need to be pushed into arrays under three hash keys)
:>push @arrayone, { one=> 'A', two => 'B', three => 'C'};
:>push @arraytwo, { four=> 'A', five => 'B', six => 'D'};
Your English text doesn't match your code. You have 6 hash keys
in the example above, not 3.
:>foreach(@arraytwo)
:> {
:> if( $_->{four} eq $_->{one}) #How should I write this?
$_ does not contain a key of 'one'.
:> {
:> print $_->{five} #here I want to get "D"
How in the world does key 'five' get you value 'D'?
:> }
:> }
Your example is too muddled for me to deduce what you are trying
to accomplish.
For a hash named %hash if you have a string that you want to push
onto an anonymous array accessed from the hash with a key value of
'A',
push @{$hash{A}}, 'some string';
To access each of the strings in an array the reference for which
is stored in a hash with key 'A',
foreach (@{$hash{A}}) {
print $_, "\n";
}
For lots of examples about comparing arrays and finding values
in arrays, etc.. Try
perldoc -q array
Just out of curiosity, is this a homework problem?
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: 31 Oct 1999 08:12:22 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: comparing text with words
Message-Id: <slrn81ojh3.66b.abigail@alexandra.delanet.com>
Bart Lateur (bart.lateur@skynet.be) wrote on MMCCLII September MCMXCIII
in <URL:news:381d2b49.2901028@news.skynet.be>:
?? Abigail wrote:
??
?? >Only a problem if you don't use "use strict". Autostringifying barewords
?? >is sometimes useful in one-liners.
?? >
?? >// Ban those damn' barewords. They're just bugs waiting to happen. *At
?? >// runtime*.
?? >
?? >use strict; catches them *at compiletime*. If you don't use use strict;
?? >you're on your own anyway.
??
?? It is just one example of a more general gripe: I hate it if the same
?? code behaves differently under slightly different circumstances. It
?? takes away the control of what happens, away from the programmer, and
?? the program goes off leading it's own life.
*boggle* Who controls whether there's a use strict or not? Snowwhite?
?? This is another example:
??
?? %foo = ( b => 'xyz' );
?? foreach (qw(a b c)) {
?? push @{$foo{$_}}, "pushed onto $_";
?? }
??
?? print @xyz;
??
?? -->
??
?? pushed onto b
??
??
?? Argh! $foo{b} is used as a *symbolic* reference, while for 'a', and 'c',
?? an anonymous array is created!
??
?? True, "use strict" will eventually catch this too, but only at
?? *runtime*.
*shrug* It's the programmers mistake. Pushing something on a string
doesn't make much sense.
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 31 Oct 1999 16:51:59 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: crypt()
Message-Id: <slrn81oste.23e.efflandt@efflandt.xnet.com>
On Fri, 29 Oct 1999 12:02:34 -0400, cater@ionet.net <cater@ionet.net> wrote:
>I trying to create an administrative perl function to view the contents of
>specific files on the server. I want to use a username/password form to
>allow access. I'm not sure the best way to do this. So far I have a form
>to enter u/p, then gives you access, but if you view source you can see my
>u/p fields. I keep looking for more info. on the crypt() function but can't
>find it. I have tried to use it, but how do i decode it to see if the
>contents are in fact correct? any help about this or suggesting another
>data structure would be great!
>
>thanx
>cater@ionet.net
It doesn't matter if they show as hidden fields on subsequent forms, as
long as the remote user had to enter them initially to get through the
first form and they are authenticated and passed on from there. Of course
passwords in the script or passwd files should be pre-crypted, so a local
user looking at the script cannot tell what it is.
See 'perldoc -f crypt'. To tell if an entered text password matches an
existing crypted password:
if (crypt($newpass,$oldpass) eq $oldpass) { # the password is good }
Of course, it is probably more reliable to restrict file access with
server directives or webserver authentication, if the files you are trying
to protect are accessible by direct URL. See your server docs.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
http://thunder.prohosting.com/~cv-elgin/
------------------------------
Date: 31 Oct 1999 13:57:51 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Difference btw PerlDBD and DBD::Oracle
Message-Id: <7vhhsv$1k7$1@gellyfish.btinternet.com>
On Thu, 28 Oct 1999 14:40:38 GMT srinvas@my-deja.com wrote:
> Hello Guys,
> I am a sqa engineer. I have been assigned two products PerlDBD and
> DBD::Oracle to test, I am done with DBD::Oracle but did not find any
> info on PerlDBD on the net, I have a feeling that both are same. If any
> guys know more info on PerlDBD and the place where I can download it
> please let me know, my email is srinvas@hotmail.com.
I have never heard of PerlDBD - however I would suspect that it is
possibly a version of Perl with DBD elements statically linked in (at a
a guess ) if it exists at all.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 31 Oct 1999 15:51:11 -0800
From: "John" <mjh@me.com>
Subject: Easy question about $FORM{'data'} variables
Message-Id: <yKZS3.33$wA2.5905@news.enterprise.net>
This may seem a stupid question but I can't this thing to work. I need to
be able to loop through the contents of a dynamic form. My code is below.
For example, I need to access $FORM{'keyword_$i'} where $i is a number. The
code below just produces the hashes. I have checked that the field
'keyword_2' for example works. Any help would be great.
while ($i < $no_of_entries) {
$currKeywords = $FORM{'keywords_$i'};
$currTitle = $FORM{'title_$i'};
$currURL = $FORM{'url_$i'};
$currDescription = $FORM{'description_$i'};
print DATA "$currKeywords#$currTitle#$currURL#$currDescription\n";
$i++;
}
John
------------------------------
Date: Sun, 31 Oct 1999 16:26:35 GMT
From: Kenneth Bandes <kbandes@home.com>
Subject: Re: Easy question about $FORM{'data'} variables
Message-Id: <381C6DBC.E4C710C9@home.com>
John wrote:
>
> This may seem a stupid question but I can't this thing to work. I need to
> be able to loop through the contents of a dynamic form. My code is below.
> For example, I need to access $FORM{'keyword_$i'} where $i is a number. The
> code below just produces the hashes. I have checked that the field
> 'keyword_2' for example works. Any help would be great.
>
> while ($i < $no_of_entries) {
> $currKeywords = $FORM{'keywords_$i'};
...
Good timing - just a few minutes ago, there was a question
"what is interpolation?", and a good reply by Bob Walton. Read it -
it applies here. $i won't interpolate in single quotes.
Ken Bandes
------------------------------
Date: Sun, 31 Oct 1999 15:21:07 GMT
From: Stephen Lee <nobody@nowhere.net>
Subject: Re: Func works first time but not second
Message-Id: <381C5EA0.B045A296@nowhere.net>
Bob Walton wrote:
> Stephen Lee wrote:
> ...
> >
> > my ($pic) = $page->content =~ m!($re)!o;
>
> The problem is with the "o" switch in the above regexp match. The
> "o" switch causes the regexp to be evaluated once and then
> remembered rather the reevaluated on the second and subsequent calls.
> The the pattern continues to match the first comic rather than the
> second or subsequent ones. Delete the "o", and it should work.
> See perlop for details of the "o" switch.
Yes! I removed the "o" and it is working fine now.
Thanks,
Stephen
------------------------------
Date: Sun, 31 Oct 1999 14:08:31 GMT
From: Kenneth Bandes <kbandes@home.com>
Subject: Re: help with Text:ParseWords
Message-Id: <381C4D5F.8F6FF4D2@home.com>
Troy Lachinski wrote:
> For starters I am a newbie, but I have read the FAQ (perlfaq4) that covered
> this topic, I have also read every post from this newsgroup since the 19th
> (hoping the same topic would be covered). I am sure I just do not
> understand the way that Text:ParseWords is supposed to work.
Well, you got farther than many who have this question. But your
problem is more basic than ParseWords.
> use Text::ParseWords;
> @new = quotewords(",", 0, $text);
Fine so far (assuming $text has a line of data).
> I have tried MANY things including:
>
> use Text::ParseWords;
> @new = quotewords(",",0,$_);
>
> $new[0] = $memory_location_counter;
> $new[1] = $plu_number;
> $new[2] = $shift_type;
> etc...
>
> but this does not seem to put any values into $new[0] and also no values
> into $memory_location_counter.
Well, no. Your assignments are backwards. Your variables have
nothing in them, and the array ends up with nothing as well. Learn
about "use strict" and the -w flag, which will help you catch
such problems.
$memory_location_counter = $new[0];
would work better, but try something like
($memory_location_counter, $plu_number, $shift_type) =
quotewords(",",0,$text);
just as you had with split in your original code.
Ken Bandes
------------------------------
Date: 31 Oct 1999 11:35:52 -0500
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: It is always like this here?
Message-Id: <7vhr58$lrb@junior.apk.net>
In article <MPG.128389a13eb7ea6e98a15c@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>In article <pudge-2910991143560001@192.168.0.77> on Fri, 29 Oct 1999
>15:44:58 GMT, Chris Nandor <pudge@pobox.com> says...
>> In article <000b8d9b.40a12527@usw-ex0101-001.remarq.com>, Mark Bluemel
>> <mark.bluemelNOmaSPAM@siemens.co.uk.invalid> wrote:
>>
>> # I've been teaching myself Perl for a few weeks, with moderate success,
>> # so I thought I'd join the newsgroup. After just one day, I'm more than
>> # half inclined to drop out again. Large amount of traffic, huge
>> # noise-to-signal ratio, cluelessness in abundance and a fair proportion
>> # of abuse - these all add up to somewhere that I'm not feeling like
>> # hanging round in.
>>
>> That is why comp.lang.perl.moderated was created.
>
>And has almost no traffic, hence almost no information.
I wouldn't say so. Mabye for me it's "just enough" since I don't have
too much time to read newsgroups.
I'm finding clpmod to be very useful. High S/N makes all the difference.
------------------------------
Date: Sun, 31 Oct 1999 17:39:54 +0100
From: "Dr.-Ing. M. Hartje" <hartje@etech.hs-bremen.de>
Subject: MacPerl 5 assign to Listelement
Message-Id: <381C70D9.155C66C6@etech.hs-bremen.de>
There is an old discussion list for MacPerl but not active yet; so my
question:
The following Program works with WinPerl 5 different ports but not on
MacPerl 5:
#!/perl
for ($i =0; $i <=10; $i++) {
$f[$i] = $i;
print "*";
};
print "\n\n elements: $#f;\ncontents:\n";
foreach $a (@f) { print $a, "="
};
On MacPerl 5 the output is:
|out of memory!
|*
On Win with a Perl 5 I got
|***********
|
| elements: 10;
|contents:
|0=1=2=3=4=5=6=7=8=9=10=
Any help preferred by email direct.
Thanks
Michael email:hartje@etech.hs-bremen.de
------------------------------
Date: 31 Oct 1999 09:04:09 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Need cgi script
Message-Id: <7vh0m9$pt$1@gellyfish.btinternet.com>
On Sat, 30 Oct 1999 23:07:24 GMT prodotes@my-deja.com wrote:
> Hello...
>
> I badly need and cgi script that sends an web form to an file on an
> linux server.
What have you tried and what problems are you having ?
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 31 Oct 1999 09:52:15 -0500
From: "claire" <claire@telix.com>
Subject: Re: Need help with error. Thanks!
Message-Id: <s1oli0fsiqi13@corp.supernews.com>
claire wrote in message ...
>I get the following error for a script I am running:
>
>TEST 4: perl syntax
> Bareword found where operator expected at multiple_choice.cgi line 341,
>near "
>
>what is a bareword? Line 341 is near where I start HTML formatting. The
>script follows:
>
> {
> print qq!
> <HTML>
> <HEAD>
> <TITLE>Your Results!</TITLE>
> </HEAD> (THIS IS LINE 341)
> <BODY BGCOLOR=FFFFD9 TEXT=000000 LINK=0000FF VLINK=808080>
> <TABLE>
> <TR Row-1>
> <TD>Ether </TD>
> <TD> $number_of_Ether </TD>
> </TR>
> <TR Row-2>
> <TD>Air </TD>
> <TD> $number_of_Air </TD>
> </TR>
> <TR Row-3>
> <TD>Fire </TD>
> <TD> $number_of_Fire </TD>
> </TR>
> <TR Row-4>
> <TD>Water</TD>
> <TD> $number_of_Water </TD>
> </TR>
> <TR Row-5>
> <TD>Earth </TD>
> <TD> $number_of_Earth </TD>
> </TR>
> </TABLE>
><P>
>Take the highest numbered column and that is your type! Check below for the
>characteristics of your type and others.
></P>
></B></FONT>
></BODY>
></HTML>!;
>
> close (RESULTS);
> }
>
>
------------------------------
Date: Sun, 31 Oct 1999 15:47:57 GMT
From: Kenneth Bandes <kbandes@home.com>
Subject: Re: Need help with error. Thanks!
Message-Id: <381C64AE.3B9FBF16@home.com>
claire wrote:
> >I get the following error for a script I am running:
> >
> >TEST 4: perl syntax
> > Bareword found where operator expected at multiple_choice.cgi line 341,
> >near "
> >
> >what is a bareword? Line 341 is near where I start HTML formatting. The
> >script follows:
> >
> > {
> > print qq!
This is your problem. You're using ! as the delimiter, but your
text contains a !. You're better off with a here document,
e.g.
print <<END_OF_HTML;
and then have a line with just END_OF_HTML after the text.
> > <HTML>
...
> >Take the highest numbered column and that is your type! Check below for the
^
oops!
That ends the quote. After that, the word "Check" is taken for a
bareword, i.e. a word that is not unambiguously interpretable as a
string or a variable (though it could be interpreted as one or the
other in certain contexts).
Unfortunately, perldoc -q bareword doesn't turn up anything, although
there's a little something in perlfaq7 under the heading,
"Do I always/never have to quote my strings or use semicolons and
commas?" Also read perlop (or any decent Perl book) on here
documents and quoting.
Ken Bandes
Ken Bandes
------------------------------
Date: 31 Oct 1999 15:38:29 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Need help with error. Thanks!
Message-Id: <7vhnpl$1tc$1@gellyfish.btinternet.com>
On Sun, 31 Oct 1999 09:52:15 -0500 claire wrote:
>
> claire wrote in message ...
>>I get the following error for a script I am running:
>>
>>TEST 4: perl syntax
>> Bareword found where operator expected at multiple_choice.cgi line 341,
>>near "
>>
>>what is a bareword? Line 341 is near where I start HTML formatting. The
>>script follows:
>>
All of Perl's diagnostic messages are described in the perldiag manpage.
>> {
>> print qq!
You use the ! as a quoting character here ...
>> <HTML>
>> <HEAD>
>> <TITLE>Your Results!</TITLE>
>
.. and it appears in your text here - everything that follows that second !
is now outside the quotes and thus the error - choose another quoting
character that is guaranteed not to occur in your text or, and some
would say even better, use a here-document instead of the explicit quotes.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 31 Oct 1999 14:27:06 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: New win32 module volInfo: have I got it right?
Message-Id: <7vhjjq$1kh$1@gellyfish.btinternet.com>
On Wed, 27 Oct 1999 21:27:54 GMT frank brown wrote:
> DESCRIPTION
>
> VolInfo provides a perl interface for the Win32 function
> GetVolumeInformation. Three functions are exportable: getFileSys,
> getLabel, and getSerno. All three functions expect a single string
> argument specifying a disk, of the form "C:".
>
> SYNOPSIS
>
> use volInfo qw(getFileSys getLabel getSerno);
>
<snip>
The only suggestion that I would make is that you might consider calling
it Win32::volInfo instead lest someone get the idea that it might work on
other systems as well
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 31 Oct 1999 14:42:08 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: perl double-split
Message-Id: <7vhkg0$1ad$1@rguxd.viasystems.com>
In comp.lang.perl.misc Ala Qumsieh <aqumsieh@matrox.com> wrote:
:>"Randy Smith" <randys@NOSPAMamigo.net> writes:
:>> Daniel Heiserer <daniel.heiserer@bmw.de> wrote in message
:>> news:3819A159.55C6D670@bmw.de...
[snip]
:>> > But assume I read a table, or comma separated file:
:>> >
:>> > #-----------file------------
:>> > me,you,karl,mary,joan
:>> > 23,3455,34543,2343,34
:>> > #-----------file------------
:>> >
:>> > and I want to split it into a file using TWO separators:
:>> > "\n" for the "lines" and "," for the columns and the resultant
:>> > should be a double-indexed field @Tmp2:
[snip]
:>Now, I would do it this way:
:> my @data;
:> while (<>) { # assuming input comes from here
:> push @data => [split /,/];
:> }
:>That's it! Now you can access your elements as you wanted:
:>Ex:
:> $data[1][1] will be 3455.
Ala gave Daniel what he asked for, but he forgot to use his ESP
module. :-) Consider that Perl provides an even better way to
handle the data Daniel showed.
A line of data containing names followed by a line of data containing
numbers. Assuming that you want to associate each name with a
corresponding number:
use strict;
my @data;
while (my $names = <>) {
my $values = <>;
unless (defined $values) {
warn "Got a line of names, but it was not followed by values.\n";
last;
}
chomp $names; # You could mess around trying to put a chomp
chomp $values; # around the reads up there, but it is easy
# to screw it up and get into a list context
my %temp_hash;
# No error checking for case where number of names not equal num values
# You could split those into temporary arrays instead of directly
# into the hash slice. That would allow better error checking.
@temp_hash{split /,/, $names} = split /,/, $values;
push @data, \%temp_hash;
}
foreach my $scores (@data) {
foreach my $name (keys %$scores) {
print $name, " had a value of ", $scores->{$name}, "\n";
}
if (exists $scores->{me}) {
my $my_score = $scores->{me};
my $i_am_the_winner = 1;
foreach my $name (keys %$scores) {
next if ($name eq 'me');
if ($scores->{$name} > $my_score) {
print $name, " beat me in this game, damnit\n";
$i_am_the_winner = 0;
}
}
print "\nNobody could beat me on that game!!!\n\n"
if $i_am_the_winner;
}
}
The hash slice assignment lets you associate an array of data names
with an array of data values in one easy step! It is a way cool Perl
feature.
You could also access it with a double index, but one of the
keys is now a name:
print "My score in the second game was ", $data[1]{me}, "\n";
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: 31 Oct 1999 13:42:30 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl script to compile C program.
Message-Id: <7vhh06$1ja$1@gellyfish.btinternet.com>
On Sat, 30 Oct 1999 23:59:45 -0400 (EDT) KernelKlink@webtv.net wrote:
> (Jonathan Stowe) wrote:
> ==============================
> I think that it might be more appropriate to read the RFD that was
> posted in that newsgroup and then act appropriately - I for one would
> like to see a group to which we could point MySQL users. I would suggest
> that encouraging people to post into a probably *inappropriate* group is
> either trolling or an attempt to manipulate the newsgroup creation
> process. Of course there are also mailing lists that deal with MySQL.
> /J\
> ==============================
>
> First, this is a Perl newsgroup and you should refrain from making it a
> soapbox from which to pontificate to us as to what you "think" about
> this or that in the realm of net etiquette.
>
You are the one who used that signature, you are the one that has
come back to gripe and moan ...
> Sending me an email would have been much more appropriate.
>
In what way would that be ?
> Second, if you can find a copy of comp.databases RFD's that show me to
> be at fault, then please send me a link or email. The only descriptions
> I could find on appropriate comp.databases posting material is in the
> name itself (comp.databases is rather generic isn't it). Also, Baylor
> University in Texas describes appropriate postings for comp.databases:
> "Database and data management issues and theory". Sounds like MySQL
> might fall under that category, doesn't it?
>
Thats moot.
> Third, you used the terms "trolling" and "manipulate" in regards to a
> "probably inappropriate group". Did you say "PROBABLY"? You should have
> checked out the RFD's yourself and been sure before you made such
> irresponsible remarks in a public forum.
>
You are either being more subtle here than I would credit or you are
genuinely ignorant of what I speak in which case I apologise for accusing you
of something for which you are blameless.
I was not referring to the RFD for or the Charter of comp.databases I was
referring to the RFD that was posted in that group for the creation of
the new group comp.databases.mysql in the last week or so. That was gave
rise to my suspicion of manipulation, that and the fact that you had
gained yourself an entry in my killfile already for insisting on your
'right' to post off-topic questions about MySQL *here* among other things
which a quick search at Deja news reminded me .
I suspect from your reaction and from your rather selective understanding
of what I wrote that you are being disingenuous here.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 31 Oct 1999 09:39:07 -0500
From: "Diane" <tech1@magicnet.net>
Subject: quick question (I hope)
Message-Id: <emcAl36I$GA.305@cpmsnbbsa02>
What would be the easiest and most effective way for a perl script to send
the user to an existing html page, after a database has been updated in the
script?
Ive tried to code in using a meta tag that includes the HTTP-EQUIV refresh
and then the URL, but the browser comes up with some error that it cant
refresh unless the data is reposted??? Kinda has be confused. The data base
is updated fine.
Any help out there?
Thanks
Diane
tech1X@magicnet.net
Please remove X in email address to send email
------------------------------
Date: Sun, 31 Oct 1999 16:04:40 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: quick question (I hope)
Message-Id: <Pine.HPP.3.95a.991031154751.10047F-100000@hpplus01.cern.ch>
On Sun, 31 Oct 1999, Diane wrote:
Subject : quick question (I hope)
Please choose meaningful Subject lines for your postings, lest they
should be ignored by those who are best able to help you.
> What would be the easiest and most effective way for a perl script to send
> the user to an existing html page,
This is clearly a CGI-related question, and hence the proper place
for it would be comp.infosystems.www.authoring.cgi, if it wasn't already
an FAQ, http://www.htmlhelp.org/faq/cgifaq.3.html#13
> after a database has been updated in the
> script?
That falls under the description "eg process form inputs and
conditionally redirect the user" used in the FAQ, I would have thought.
The fact that a database is updated is just part of the processing, and
has no particular influence on the question of how one issues a
redirection transaction.
FAQs are good for you. Asking them on usenet (especially on a group
where they are off-topic) is not.
> Ive tried to code in using a meta tag that includes the HTTP-EQUIV refresh
> and then the URL, but the browser comes up with some error that it cant
> refresh unless the data is reposted???
Oh, good. Most clue-impaired people seem to use this third-rate ersatz
method of giving a muddled impression of a redirection, without ever
getting any immediate warning that they are creating problems.
> Kinda has be confused.
This will be obvious when you understand about non-idempotent requests.
;-}
------------------------------
Date: 31 Oct 1999 13:54:36 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Sub in which module
Message-Id: <7vhhms$1k4$1@gellyfish.btinternet.com>
On Thu, 28 Oct 1999 08:57:01 -0700 Samay wrote:
> Hi, I have main program which list several use statement and code.
> How I can find that particular subroutine is in which module?
>
Just for fun you might try the following :
#!/usr/bin/perl -w
use CGI qw(:all);
foreach (keys %CGI::)
{
print "$_ $CGI::{$_}\n";
}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 31 Oct 1999 16:07:08 GMT
From: "G. Jesse Kuhnert" <jkuhnert@bellatlantic.net>
Subject: Re: Telnet Question
Message-Id: <381C68B1.43848C35@bellatlantic.net>
No, you're right Martien......I did go ahead and add the module to my
own cgi-bin directory and made it work. Sorry to all for causing any
trouble.
G. Jesse Kuhnert
Martien Verbruggen wrote:
>
> On Sat, 30 Oct 1999 23:49:33 GMT,
> G. Jesse Kuhnert <jkuhnert@bellatlantic.net> wrote:
>
> [question about installing Net::Telnet in own directory somewhere]
>
> > I know you guys hate newbie questions, but please feel pity for a humble
>
> We don't hate newbie questions. We just don't like people who come here
> to beg for solutions without being prepared to do any owrk themselves,
> or people who talk about stuff that is totally unrelated to Perl. In
> general, if someone who is new to Perl shows that he or she has done
> whatever they can to get to where they want to be, but simply get stuck,
> you'll find that we don't have any trouble answering at all.
>
> > little Perl beginner. I have read the FAQ's/man-pages/etc....It's not
>
> Have you also read the part of Perl FAQ 8 that talks about how you can
> keep your own module directory? And the questions around that one? Thos
> should be exactly what you are looking for.
>
> The following ones should be interesting:
>
> # perldoc perlfaq8
> How do I install a CPAN module?
> How do I keep my own module/library directory?
> How do I add the directory my program lives in to the
> module/library search path?
> How do I add a directory to my include path at runtime?
>
> Most of these would have shown up with a
>
> # perldoc -q module
>
> or, slightly less verbose:
>
> # perldoc -q module | grep =head
>
> > like I haven't tried to solve the problem myself. I'm just not
> > experienced enough in Perl to write my own socket connection to a remote
> > Telnet host yet...
>
> No need to write raw sockets stuff. In this case it would be too much
> work anyway :)
>
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division | Make it idiot proof and someone will
> Commercial Dynamics Pty. Ltd. | make a better idiot.
> NSW, Australia |
------------------------------
Date: Sat, 30 Oct 1999 23:27:06 -0500
From: TK Soh <r28629@email.sps.mot.com>
Subject: Re: use heredoc to assign var?
Message-Id: <381BC51A.A10B6399@email.sps.mot.com>
Eric Bohlman wrote:
>
> * Tong * (sun_tong@geocities.com) wrote:
> : Can I use heredoc to assign a bunck of txt to a varible?
>
> Yes.
>
> :
> : Like,
> :
> : $var=<< "EOF"
> : bla bla bla
> : EOF
> :
> : how can I do that? thanks
>
> You just need to make two changes:
>
> 1) Drop the space before "EOF"
the space doesn't hurt as EOF is quoted.
-TK
------------------------------
Date: Sun, 31 Oct 1999 07:33:01 -0800 (PST)
From: J Garcia <garcia868@yahoo.com>
Subject: What is "interpolation"?
Message-Id: <19991031153301.6860.rocketmail@web1602.mail.yahoo.com>
The term "interpolation" is used much in the Perl
documentation. What exactly does it mean in the Perl
programming context? Could somebody give pointers to
Perl docs and programs available online which
illustrate this concept? Thanks.
=====
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
------------------------------
Date: Sun, 31 Oct 1999 10:49:34 -0500
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: What is "interpolation"?
Message-Id: <381C650E.D71AFA54@rochester.rr.com>
J Garcia wrote:
>
> The term "interpolation" is used much in the Perl
> documentation. What exactly does it mean in the Perl
> programming context? Could somebody give pointers to
> Perl docs and programs available online which
> illustrate this concept? Thanks.
...
See perlop, under the section "Quote and Quote-like Operators".
If you don't know how to do that, try:
perldoc perlop
at your system's command line prompt.
Generally, the term "interpolation" refers to the
substitution of a portion of one string for another in certain
contexts. The most command context is the "..." literal string
operator. Things that are interpolated in this context are
like \n getting interpolated to a newline, $a getting
interpolated to whatever its value is, etc. Example:
$a='hi there';
print "blah $a blah blah\nline two\n";
prints
blah hi there blah blah
line two
--
Bob Walton
------------------------------
Date: 31 Oct 1999 16:31:38 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: What is "interpolation"?
Message-Id: <7vhqta$305$1@rguxd.viasystems.com>
J Garcia <garcia868@yahoo.com> wrote:
:>The term "interpolation" is used much in the Perl
:>documentation. What exactly does it mean in the Perl
:>programming context? Could somebody give pointers to
:>Perl docs and programs available online which
:>illustrate this concept? Thanks.
My dictionary defines interpolate:
1. To insert or introduce between other things or parts.
2. To change (a text) by introducing new or false material.
If you remove the "or false" from the second definition, it applies
as well as the first one.
Generally it means to replace a variable (or function call) with the
value(s) of that variable (or return value(s) of the function call).
When and how it happens is a large part of understanding the syntax.
The simplest example is interpolation of a scalar value in a double
quoted string:
$var = 'some value';
print "My variable contains $var\n";
# Becomes after interpolation
print 'My variable contains some value
';
And so the print subroutine could care less about $var since
it has already been interpolated into the string that print sees.
Note also the \n is interpolated in the above example before print
sees it.
There is, I am sure, a more exact definition, but then you would have
to learn the definitions of a bunch of other words that have specific
meanings to CS majors (I'm just an Engineer and so don't bother with
those details unless they bite me :-). You don't really need a
better definition to understand the word interpolation in context in
the Perl documentation.
I think that the best set of examples can be found in "perlop" in
the section about quoting and quote-like operators. That covers
many of the interpolation rules.
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
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 1237
**************************************