[12484] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6084 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 22 00:07:33 1999

Date: Mon, 21 Jun 99 21:00:21 -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           Mon, 21 Jun 1999     Volume: 8 Number: 6084

Today's topics:
    Re: 2 simple (not to me tho) questions <walton@frontiernet.net>
    Re: 2 simple (not to me tho) questions (Fuzzy Warm Moogles)
    Re: 2 simple (not to me tho) questions (Larry Rosler)
        aarrggghhh opening a file... <maistro@swi.hu>
        Beginner Perl Question (Howie)
    Re: Breaking up is hard to do <walton@frontiernet.net>
        fork on NT <phlippy@bellatlantic.net>
    Re: function to read a line & return it <zjagrantz@znrcanz.gcz.ca>
    Re: function to read a line & return it <zjagrantz@znrcanz.gcz.ca>
        how to sort uniq <zxwj@yahoo.com>
    Re: how to sort uniq <tchrist@mox.perl.com>
    Re: Is Perl4 Y2K compliant? <dwb1@home.com>
    Re: Is Perl4 Y2K compliant? (Tri Tram)
        Is there a way to access the volume label on a CDRW? (rogdh)
    Re: Language choice for high-volume Oracle CGI interfac <firstsql@ix.netcom.com>
    Re: looking for: CHRIS in RANCHO BERNARDO/ PERL JAVA MA <rootbeer@redcat.com>
    Re: Modem control in perl? (Greg Andrews)
    Re: Multidimensional Associative (hash) array <mjcarman@zeus.ia.net>
        Net/FTP periwinkle96088009@my-deja.com
    Re: Network Address Translation <rootbeer@redcat.com>
    Re: Piping through Less. <rick.delaney@home.com>
    Re: Please Help with Perl 5 (Casey R Tweten)
        Please help: Delete Reg Key with Sub-Keys. roberthp@my-deja.com
    Re: Return value in script. <rick.delaney@home.com>
        simple requirement..help please! <technology@workmail.com>
    Re: sorting on 2 fields <walton@frontiernet.net>
        syb perl date (Tri Tram)
    Re: system call <rick.delaney@home.com>
    Re: Unsigned integer behavior (Ilya Zakharevich)
        Upload Module? <splinter@monmouth.com>
        VBScript vs PerlScript <along@gte.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 21 Jun 1999 22:08:38 -0400
From: Bob Walton <walton@frontiernet.net>
To: crt@highvision.com
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <376EF026.56082447@frontiernet.net>

Casey R Tweten wrote:

> ...I agree, in fact, why is that so long?
>
> my @animal=("c","a","t");
> print foreach @animal;

If shorter is better...

my @animal=("c","a","t");
print for @animal;




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

Date: 22 Jun 1999 02:55:56 GMT
From: tgy@chocobo.org (Fuzzy Warm Moogles)
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <7kmtvs$f32$0@216.39.141.200>

On Mon, 21 Jun 1999 22:08:38 -0400, Bob Walton <walton@frontiernet.net>
wrote:

>Casey R Tweten wrote:
>
>> ...I agree, in fact, why is that so long?
>>
>> my @animal=("c","a","t");
>> print foreach @animal;
>
>If shorter is better...
>
>my @animal=("c","a","t");
>print for @animal;

I can only hope people are being purposely obtuse.

    print @animal;

-- 
Fuzzy | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=


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

Date: Mon, 21 Jun 1999 20:39:51 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <MPG.11d8a55ac11666a3989c13@nntp.hpl.hp.com>

In article <slrn7mtget.2o8.morpheus@rpglink.com> on 21 Jun 1999 22:51:12 
GMT, Steve Lamb <morpheus@despair.rpglink.com> says...
> On 21 Jun 1999 22:40:26 GMT, Weborium <weborium@aol.com> wrote:
> >1. How do I remove spaces when printing an array? If @animal=("c","a","t");
> >I just want to print cat.
> 
> foreach (@animal){
>   print("$_");
> }
> print("\n");

Let's peel this onion.

  foreach (@animal) { print("$_") }
  print("\n");

  print("$_") for @animal;
  print("\n");

  print "$_"  for @animal;
  print "\n";

  print $_ for @animal;
  print "\n";

  print for @animal;
  print "\n";

  print @animal;
  print "\n";

  print @animal, "\n";

Not much of a meal left.  :-(

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 21 Jun 1999 17:47:00 +0200
From: "Oreg Dixie" <maistro@swi.hu>
Subject: aarrggghhh opening a file...
Message-Id: <7klmse$5og$1@pollux.matav.net>

Hi!

I'm trying to open a file like this:

$forumfile = param("forumfile"); #form's textfield

open(IDOUT, ">$forumfile");
 .
 .
 .
close(IDOUT);

But it stops at the open, don't want to create the file and the browser
didn't display the whole CGI...

Thanks again & again!
Flt




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

Date: Tue, 22 Jun 1999 02:43:38 GMT
From: noone@home.com (Howie)
Subject: Beginner Perl Question
Message-Id: <uLCb3.3848$Lx2.3040@news.rdc1.sdca.home.com>

Is it possible to execute a script every 2 hours ( I need to delete cached 
files) using Perl or a CGI script? Or would I have to use a complete different 
language?
thanks


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

Date: Mon, 21 Jun 1999 22:02:24 -0400
From: Bob Walton <walton@frontiernet.net>
To: Jacques Rall <rall@trema.com>
Subject: Re: Breaking up is hard to do
Message-Id: <376EEEAF.AC37A0C@frontiernet.net>

Jacques Rall wrote:

> Hi all,
>
> I have a very long string, about 1000 characters, which I need to split
> up into 80 character lines or fields.

Jacques, try something like:

$in="this is a very long line..." x 100;
while($in=~/(.{80,80})/g){
 print "$1\n"; #use push @out,$1; to save the pieces to an array
}




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

Date: Tue, 22 Jun 1999 02:29:20 -0300
From: Philip DiFalco <phlippy@bellatlantic.net>
Subject: fork on NT
Message-Id: <376F1F2F.D8FE8500@bellatlantic.net>

when will fork() be available on NT?




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

Date: Mon, 21 Jun 1999 23:45:21 -0400
From: "John A. Grant" <zjagrantz@znrcanz.gcz.ca>
Subject: Re: function to read a line & return it
Message-Id: <7kn0vd$2kd15@nrn2.NRCan.gc.ca>

Larry Rosler wrote in message ...
>In article <7kjtpa$2kf5@nrn2.NRCan.gc.ca> on Sun, 20 Jun 1999 19:32:30 -
>0400, John A. Grant <zjagrantz@znrcanz.gcz.ca> says...
>> Larry Rosler wrote in message ...
>> >In list context, 'return undef;' returns a list with one element, the
>> >value of which is undef.  'return;' returns a list with no elements,
>> >which is usually more appropriate.
>>
>>     So if 'success' returns "$_", is a list with no elements
>>     appropriate for the converse case (failure)?
>
>Asuming you mean by this:  If 'success' returns in scalar context the
>value of $_, then 'failure' should return undef.  If it returned an
>empty list, in scalar context the value would be the size of the list,
>or 0.

    Ok, that makes sense. Since I'm calling the function like this:
        my $lineoftext=ReadLine();

    then it should either "return $_" (success) or "return undef" (failure).

>If you put a space after the two hyphens, then savvy newsreaders won't
    [...]

    The "--" isn't in my .sig file - the newsreader adds "--", so
    I don't have the choice.

--
John A. Grant  * I speak only for myself *  (remove 'z' to reply)
Airborne Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here




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

Date: Mon, 21 Jun 1999 23:46:46 -0400
From: "John A. Grant" <zjagrantz@znrcanz.gcz.ca>
Subject: Re: function to read a line & return it
Message-Id: <7kn122$2ke13@nrn2.NRCan.gc.ca>

Mike Coffin wrote in message <8p6iu8ixj3a.fsf@Eng.Sun.COM>...
>"John A. Grant" <zjagrantz@znrcanz.gcz.ca> writes:
>
>>     It seems 'fragile' to rely on it getting the proper context to
>>     determine what "return;" should actually return.  After all,
>>     "sub" doesn't exactly specify the type of the returned value.
>>     I'm not used to letting the interpreter make these decisions.
>
>This is a fundamental and pervasive feature of Perl, so if you want to
>use Perl you have to get used to it.  (Most languages have their
>obsessive little quirks; chalk this one up along side Python's
>whitespace and Lisp's parentheses.)

    Thanks for the quiet perspective on the issue. That's more
    helpful than shouting at me to "stop programming in Perl". :)

--
John A. Grant  * I speak only for myself *  (remove 'z' to reply)
Airborne Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here






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

Date: Mon, 21 Jun 1999 19:05:29 -0700
From: "xin zhou" <zxwj@yahoo.com>
Subject: how to sort uniq
Message-Id: <7kmr17$kj63@sunami.kla-tencor.com>

It seems the built-in sort function does not provide csh's sort -u.
As a new perl user, I had to write a block to achieve the effect. Can you
experienced guys write one of those crytic one-liners to do it?
Thanks!
Xin





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

Date: 21 Jun 1999 20:20:08 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: how to sort uniq
Message-Id: <376ef2d8@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    "xin zhou" <zxwj@yahoo.com> writes:
:It seems the built-in sort function does not provide csh's sort -u.

I was unaware that the csh had a sort function.  When did
this happen?

:As a new perl user, I had to write a block to achieve the effect. Can you
:experienced guys write one of those crytic one-liners to do it?

You mean besides what's in the FAQ?

--tom
-- 
"C is not a big language, and it's not well served by a big book." (Brian W.
Kernighan and Dennis M. Ritchie, in "The C programming Language", Prentice
Hall 1988)


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

Date: Tue, 22 Jun 1999 03:11:49 GMT
From: "Daniel W. Burke" <dwb1@home.com>
Subject: Re: Is Perl4 Y2K compliant?
Message-Id: <Pine.LNX.3.96.990621224341.31775B-100000@cc569157-a.warn1.mi.home.com>

On Sun, 20 Jun 1999, twod wrote:

> Daniel W. Burke (dwb1@home.com) wrote:
>:and or variables the language has.  As a result of my seeking if perl4 is
>:"Y2K Compliant" I've learned about the odd-ness (well, I think it's odd) of
>:how localtime() returns the year, and was able to fix 2 scripts this morning.
> 
> Is that 'oddness' documented ? :) 
> 
> Can the language be blamed if the developers and code-readers don't RTFM ? :)

Actually, the O'reilly book I have been using for reference was not clear on
that point... that'll teach me to use anything but perldoc I guess :P

> When was your PERL4 binary built ?

Oh boy, probably at LEAST 3 or 4 years ago... but considering how long perl5
been out, I'd say longer.

> Using what version of the OS ?
> Are they all Y2K compliant ?

Been on that long upgrade process (*ugh* my boss left all the Y2K upgrades
to me)...

Dan.




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

Date: Tue, 22 Jun 1999 03:02:53 GMT
From: tram@olympic.seas.ucla.edu (Tri Tram)
Subject: Re: Is Perl4 Y2K compliant?
Message-Id: <FDpKGt.Gv6@seas.ucla.edu>


what if  you do a call to time?
something like: 
print localtime(time());

bachrach V2.0 (bachrach@*God-I-hate-spam*bigfoot.com) wrote:
> Daniel W. Burke wrote in message ...
> >
> >Hopefully I can wade through all these messages to see the response...
> >but, can perl4 be considered "Y2K Compliant"?  I imagine so, but we have
> >an aweful lot of scripts at work that run off perl4/oraperl...
> >I don't think anyone else has thought to ask at work wether or not we
> should
> >take the time to make sure all the scripts work with perl 5, and just
> update
> >the darn things, but I figured better I better ask :)


> Okay, maybe there's just something I'm missing, but how can a programming
> language itself by Y2K compliant? I mean, when you make a program that has
> some sort of a date feature, you store it as either a 2 or 4 digit number.
> Each program that you wrote in perl then would have to be Y2K complaint at
> your end - either you made it correctly or not. How exactly would a language
> itself be or not be Y2K compliant? Perl itself isn't executable, it's the
> compilers, interpreters, and programs you make with it that are or are not
> Y2K compliant.

> --
> Do something good with your life:
> http://www.vjnews.com/iranpetition.htm

> Get free stock in an internet company (I ain't kidding)
> http://www.tradehall.com/cgi-bin/trader/hs.cgi?run=invest
> and if you could be so kind as to put in refrence number 10235784 I'd
> *really* apreciate it




--
-----------------------------------------------------------------
Tri Tram, Computer Science and Engineering at UCLA
http://www.seas.ucla.edu/~tram


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

Date: Tue, 22 Jun 1999 03:31:52 GMT
From: rogdh@iname.com (rogdh)
Subject: Is there a way to access the volume label on a CDRW?
Message-Id: <376f034c.6111658@news.mindspring.com>

I have a CDRW that I use for backup.

Sometimes, I forget to switch music CDs with my backup CDRWs
at the end of the evening.

I'd like to test the volume label of the CDRW for a string to see if
the correct CDRW is in the drive.

Is there a way....


thank you

roger


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

Date: Mon, 21 Jun 1999 20:11:19 -0700
From: Lee Fesperman <firstsql@ix.netcom.com>
Subject: Re: Language choice for high-volume Oracle CGI interface?
Message-Id: <376EFED7.35EB@ix.netcom.com>

Randal L. Schwartz wrote:
> >>>>> "Lee" == Lee Fesperman <firstsql@ix.netcom.com> writes:
> Lee> ..... Perl was not designed and
> Lee> is not used "specifically for CGI programming with database."
> 
> And the advantage to using a language that is a subset of another
> langauge is...?

Actually, there are a lot of disadvantages to using a 'subset' of a language for 
specific purpose (like using a subset of Perl for CGI). Assuming you're advocating using 
a subset of Perl (so you don't have to learn the full blown language), the disadvantages 
of that approach include:

+ You must clearly document this subset, carefully leaving out complexities of the 
language that are not needed. What to include can be a very hard choice to make.

+ To a user of the subset, many of the elements will be counter-intuitive since they 
were actually designed for a larger purpose.

+ Certain aspects of the processing will always be a 'misfit' (impediance mismatch) with 
the language. For instance, access to CGI variables in Perl always requires an explicit 
lookup. These aspects will never make 'sense' to the subset user.

If you are recommending that Perl CGI is a good choice for an experienced developer in 
Perl, I wholeheartedly agree with you.

Jive (http://www.firstsql.com/jive/), OTOH, was designed from the ground up as a 'web 
servlet' language that is especially efficient in (but not limited to) CGI. It is not a 
subset of any other language, though it borrows some syntax from SQL. This is 
appropriate because SQL is integrated into the language.

--
Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)


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

Date: Mon, 21 Jun 1999 19:11:03 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: looking for: CHRIS in RANCHO BERNARDO/ PERL JAVA MAN
Message-Id: <Pine.GSO.4.02A.9906211905130.1698-100000@user2.teleport.com>

On Mon, 21 Jun 1999 mike@pec.net wrote:

> If anyone know Chris, i think he lives (lived) in
> Rancho Bernardo, CA... please send this to him.

I think I saw him post something in one of the java newsgroups last week.
You should probably post to all of them to be sure he sees it. Or maybe it
was a newsgroup about the web? Maybe alt.* or news.*, now that I think of
it. And if that doesn't work, you could ask people at supermarkets if
they've seen him - after all, he's got to buy produce and toilet paper
sooner or later. It helps to have a recent photograph, though.

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 21 Jun 1999 20:44:31 -0700
From: gerg@shell.ncal.verio.com (Greg Andrews)
Subject: Re: Modem control in perl?
Message-Id: <7kn0qv$1ko$1@shell1.ncal.verio.com>
Keywords: modem serial war-dial ioctl

rdawes@intekom.co.za writes:
>Hi folks,
>
>I am trying to control a modem from a perl script.  I have successfully
>managed to talk to the modem, issue commands, receive input, etc.  I am
>pretty happy with it so far.
>
>However, I have one nagging problem that I do not know how to solve:
>
>How do I raise or lower DTR(?) to make the modem hang up?
>
>I have tried to use the '+ + + AT' (without the spaces) and it works on
>one modem, but not on the next.  I believe that dropping DTR (or one of
>the lines) is the correct way to force a modem to drop the connection.
>I think it should also be more reliable.  Is this something I should be
>trying to use an IOCTL for?
>

One of the traditional methods was to issue an ioctl call to
set the port's speed to 0 bps, wait a second or two, and then
set the speed back to the normal value.

I don't know whether the Linux tty driver will drop DTR when
the speed is set to 0.  It may want you to make a different
ioctl call.

The other traditional method is to close the port.  :-)

  -Greg


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

Date: Mon, 21 Jun 1999 21:59:15 -0500
From: Michael Carman <mjcarman@zeus.ia.net>
Subject: Re: Multidimensional Associative (hash) array
Message-Id: <376EFC03.1F28DC48@zeus.ia.net>

I'll offer a few tips here. First, references are pretty easy. To get a
reference to a hash, just do this:
    $hash_ref = \%hash; # The "\" makes a reference

So now you can access %hash through $hash_ref:
    keys %{$hash_ref}   # Get the keys of %hash
    $hash_ref->{"key1"} # Find the value of $hash{"key1"}
    etc...

And because references are scalars, they're much easier to pass to
subroutines without worrying about things getting flattened or smashed
together. This is especially useful if you want to pass multiple hashes or
arrays as arguments.

> split ($;,$HASH_ARRAY{$HASH_KEY});
> @ATTR_ARRAY = @_;

-w complains about this being bad form:
"Use of implicit split to @_ is deprecated at foo.pl line 48."

It works, but you're better off using
    @ATTR_ARRAY = split ($;,$HASH_ARRAY{$HASH_KEY});
instead. It's clearer if nothing else.

Finally, congratulations on making your first script work, but you're making
things much harder on yourself than you need to. (Welcome to the world of
TMTOWDI -- "There's More Than One Way To Do It.") You can let Perl do the
dirty work of hiding one hash within another for you:

#!/usr/local/bin/perl -w
$hash{"FIRST"}{"A1"}  = "Attribute 1 of FIRST";
$hash{"FIRST"}{"A2"}  = "Attribute 2 of FIRST";
$hash{"FIRST"}{"A3"}  = "Attribute 3 of FIRST";
$hash{"SECOND"}{"A1"} = "Attribute 1 of SECOND";
$hash{"SECOND"}{"A2"} = "Attribute 2 of SECOND";
$hash{"SECOND"}{"A3"} = "Attribute 3 of SECOND";
$hash{"THIRD"}{"A1"}  = "Attribute 1 of THIRD";
$hash{"THIRD"}{"A2"}  = "Attribute 2 of THIRD";
$hash{"THIRD"}{"A3"}  = "Attribute 3 of THIRD";

# Let's see what we just created
foreach $outer_key (sort keys %hash) {
    print "$outer_key:\n";
    foreach $inner_key (sort keys %{$hash{$outer_key}}) {
        print "    $inner_key = $hash{$outer_key}{$inner_key}\n";
    }
}

The inner keys don't have to all be the same, either, but if you're doing
this it's likely that you're trying to create a
struct/record/object/whatever you wnat to call it depending on what you're
used to programming in, so they often will be.

This really is more advanced than one is likely to encounter in their first
stab at Perl. I take it that "Hello, world!" just wasn't enough of a
challenge? Technically, I believe that what this approach really does is
create a hash of references to other (anonymous) hashes. (Corrections,
anyone?) That is, the value of $hash{"FIRST"} is a reference to an unnamed
hash which has key/value pairs "A1" , "Attribute 1 of FIRST", "A2",
"Attribute 2 of FIRST", etc. If that didn't make sense, don't worry about
it. You don't need to know everything that happens behind the curtain for it
to be useful. It is good to learn, though.

-mjc




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

Date: Tue, 22 Jun 1999 02:05:26 GMT
From: periwinkle96088009@my-deja.com
Subject: Net/FTP
Message-Id: <7kmr10$rt3$1@nnrp1.deja.com>

I'm trying to setup a webcam in my apartment and I wanted to transfer
the image file via ftp to my webserver every 40 seconds across an
unreliable modem connection.

I wrote my camera daemon to maintain a constant connection to the ftp
server and then go into a "wait" (while loop) state until the connection
is brought back up again. I set the Timeout for 30 seconds and turned on
Debug.

For the most part the script works, there's just one little oddity:

Occasionally the server will come back with it's "Opening BINARY
connection" but my ftp->put will not respond by sending the file.
Eventually the SERVER will time out after 5 minutes! During this time
the picture, currshot.jpg, is a zero length file serving no purpose
other than to annoy visitors. After the 300 second timeout the server
will close the control connection and the script will realize that the
ftp->put didn't work, then close and reopen the ftp link.

While the script recovers, the long timeout is unacceptable as is the
fact that I don't want to be filling up my server's log files with lots
of ftp connection messages. I would greatly appreciate any help or work
around you could provide. Even a good explaination would be great.

-John


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Mon, 21 Jun 1999 19:02:07 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Network Address Translation
Message-Id: <Pine.GSO.4.02A.9906211901230.1698-100000@user2.teleport.com>

On Mon, 21 Jun 1999, Clayton Schutz wrote:

> I would like to know if it is possible to run several websites from
> one IP address using Network Address Translation.

Perhaps you should check the docs, FAQs, and newsgroups about websites for
more information. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 22 Jun 1999 03:23:33 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Piping through Less.
Message-Id: <376F0175.770B5C06@home.com>

[posted & mailed]

ktb wrote:
> 
> I have the following script which works fine but I can't figure out how
> to pipe the output from the program to 'less' on my Linux system so I
> can view all the output.

What's wrong with actually piping to less?

$ perl yourprog | less

If you want to do it from inside your program then just open a pipe to
less:

open STDOUT, '|less' or die "Can't fork: $!\n";
# print whatever here
close STDOUT;

perldoc -f open

Don't forget the close() or your program might exit and close before you
have a chance to page through the output.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Tue, 22 Jun 1999 02:14:17 GMT
From: crt@highvision.com (Casey R Tweten)
Subject: Re: Please Help with Perl 5
Message-Id: <376ef00a.615675409@news.kiski.net>

On Mon, 21 Jun 1999 14:50:09 -0700, "Ron Lukawitski"
<luka@islandnet.com> wrote:

: I'm in real need of some serious help and hoping that I can find it here.

Seriousness?  Here?  Not possible!

: I need to know if Perl 5 is capable of compiling the information from the
: enclosed e-mail responses to a musicians (Bass Players)
: survey that I am conducting on the internet. I have well over 1'000
: responses and they all pretty much look like the 2 samples below.
: I need Perl to compile the following:

Yes, Perl can do that, in fact, Perl can do just about anything.

I am trying to make time to develop some sctipts to make my lunch and
take out the garbage.  Sooner or later...

: I'm new to Perl programming and would really appreciate all the help I can
: get. I just bought the latest Perl 5 For Dummies which I really enjoy.

First order of business, burn your book.

Second, for those 'serious help needing' times, buy Programming Perl,
2nd addition.

www.ora.com

--
Casey Tweten  HighVision Associates
Web Developer http://www.highvision.com
<joke> This is 100% certified,
       virus and bug free code </joke>


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

Date: Tue, 22 Jun 1999 00:39:09 GMT
From: roberthp@my-deja.com
Subject: Please help: Delete Reg Key with Sub-Keys.
Message-Id: <7kmlvd$q6g$1@nnrp1.deja.com>

Hello folks:

I'm totally new to this Perl thing (just started today), and I'd like
to figure out how to delete a registry key that has sub-keys.  The key
I'm trying to delete is:

HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components

Under \Installed Components are keys for each of the elements of an
installed copy of IE, such as VRML support, Task Scheduler, FP Express,
etc., etc.

I need to be able to delete the entire \Installed Components key, and
all the sub-keys, in a very simple construct.

What I've figured out so far (potentially) is that the following will
delete a key value (186 in this case):

$tips= $Registry->{"LMachine/Software/Microsoft/"}->
              {"Windows/CurrentVersion/Explorer/Tips/"}
      or  die "Can't find the Windows tips: $^E\n";
    $tip186= delete $tips{'/186'};

And this will delete a key:

    $tips= delete $Registry->{"CUser/Software/Microsoft/Windows/" .
                              "CurrentVersion/Explorer/Tips/"};

However, the documentation talks about not being able to delete a key
with sub-keys using these methods, but doesn't give any way to do so.

I've also tried (from other documentation I found)...:

use Win32API::Registry 0.13 qw( :ALL );
RegOpenKeyEx ( HKEY_LOCAL_MACHINE, "SOFTWARE/Microsoft/Active
Setup/Installed Components", 0, KEY_READ, $key )
	or  die "Can't open
HKEY_LOCAL_MACHINE/SOFTWARE/MICROSOFT/ACTIVE SETUP/INSTALLED
COMPONENTS: $^E\n";
RegDeleteKey ( HKEY_LOCAL_MACHINE, "SOFTWARE/Microsoft/Active
Setup/Installed Components" )
	or  die "Can't delete
HKEY_LOCAL_MACHINE/SOFTWARE/MICROSOFT/ACTIVE SETUP/INSTALLED
COMPONENTS: $^E\n";

When I use the above, I get "Can't open
HKEY_LOCAL_MACHINE/SOFTWARE/MICROSOFT/ACTIVE SETUP/INSTALLED
COMPONENTS:  The system cannot find the file specified

Can anyone just give me a code snippet on how to delete a key with sub-
keys, or point me to some code?  It *has* to be fairly straight-
forward, but not being a programmer is really hampering my ability to
figure this out.

Thanks,
Robert


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 22 Jun 1999 03:44:45 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Return value in script.
Message-Id: <376F066C.C652E86F@home.com>

[posted & mailed]

ktb wrote:
> 
> Hi, I have this script that I can search a file of mine.  The script
> works fine but I'm trying to get it to print "No string found." if the
> search is not sussessful.

[snip]
 
> if ($PartsFile =~ /\Q$SearchString/i) {
> 
> result();
> 
> }

&result will only be executed if there is a match.  If you only want to
print "No string found." when it doesn't match, then add an else clause:

else {
    print "No string found.\n";
}

perldoc perlop and look up m//.  You might also want to look up the
difference between lt and < while you're there.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Mon, 21 Jun 1999 19:15:15 -0700
From: Raj <technology@workmail.com>
Subject: simple requirement..help please!
Message-Id: <376EF1B3.9A2834C1@workmail.com>

Hi,
I have a shellScript "prog.sh". How do i call this from within my
CGI/Perl Script??
I used system command but it is not executing at all. Any help
please!!!! TIA,
Raj



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

Date: Mon, 21 Jun 1999 23:02:56 -0400
From: Bob Walton <walton@frontiernet.net>
To: Jeff.Epstein@ericsson.com
Subject: Re: sorting on 2 fields
Message-Id: <376EFCE0.E0122CE9@frontiernet.net>

Jeff Epstein wrote:

> ...

> I have Wins, Losses, Ties, PF (points for), etc. I'd like to sort on
> Wins-Ties-PF,
> ...

>
> My array rows look like:
>
> TeamA|11|4|1|430
> TeamB|11|4|1|435
> TeamC|12|4|0|465
>
> How do I sort so that the standings seen are C B A in this case?
> (C has the best record of 12-4, while A&B have identical records but B
> has
> more points.)
>
> I've looked at
> http://language.perl.com/newdocs/pod/perlfaq4.html#How_do_I_sort_an_array_by_anyth
> and it's associated links but I don't understand how to make it work.
>
> ...

Jeff, try:

open IN,"junk6.txt" or die "Oops, $!\n";
@in=<IN>;
close IN or die "Whoops, \n";
chomp @in;
@out=sort byscore @in;
for(@out){
 print "$_\n";
}
sub byscore {
 my($teama,$runsa,$tiesa,$lossesa,$pointsa)=split('\|',$a);
 my($teamb,$runsb,$tiesb,$lossesb,$pointsb)=split('\|',$b);
 $runsb<=>$runsa or
 $tiesb<=>$tiesa or
 $pointsb<=>$pointsa;
}




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

Date: Tue, 22 Jun 1999 02:34:39 GMT
From: tram@olympic.seas.ucla.edu (Tri Tram)
Subject: syb perl date
Message-Id: <FDpJ5r.8E0@seas.ucla.edu>


You should look into the Sybase documentation.  It has a function that
will let you select the date in a certain format that you want.

--
-----------------------------------------------------------------
Tri Tram, Computer Science and Engineering at UCLA
http://www.seas.ucla.edu/~tram


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

Date: Tue, 22 Jun 1999 03:32:25 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: system call
Message-Id: <376F038D.FB75BC7A@home.com>

[posted & mailed]

Raj wrote:
> 
> Hi,
> I have a shellScript "prog.sh". How do i call this from within my
> CGI/Perl Script??
> I used system command but it is not executing at all.

system should execute it if all is well.  You should check the success
of your system call to see what may have went wrong.

perldoc -f system

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 22 Jun 1999 03:09:34 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Unsigned integer behavior
Message-Id: <7kmupe$8ss$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Peter Friend
<octavian@earthlink.net>],
who wrote in article <7kmid7$9d6$1@oak.prod.itd.earthlink.net>:
> Is there a way to get unsigned integer behavior? The integer module
> uses signed integers.

AFAIK there is absolutely no difference between signed and unsigned
arithmetic.  The *only* difference is the conversion to double or
string.  Use sprintf with appropriate flags to do this.

Ilya


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

Date: Mon, 21 Jun 1999 22:28:39 -0400
From: "Matt" <splinter@monmouth.com>
Subject: Upload Module?
Message-Id: <7kmsa9$q1c$1@news.monmouth.com>

Hi,

Anyone know of any modules used for uploading images of types such as .gif
or .jpeg.  I'm sure they are out there, I have seen some I'm pretty sure but
I need an opinion on a "best one".

Thanks,

-Matt




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

Date: Tue, 22 Jun 1999 03:44:30 GMT
From: "Andy Long" <along@gte.net>
Subject: VBScript vs PerlScript
Message-Id: <xEDb3.947$Xr2.47215@dfiatx1-snr1.gtei.net>

In a VBScript an OLE event is:

function MSCSExecute(config, orderform, context, flags)
    MSCSExecute = 1
end function

I tried the following in PerlScript:

sub MSCSExecute {
    local($config, $orderform, $context, $flags);
    local($ret);
    $ret = 1
    return $ret;
}

However it does not seem to work, anyone got any ideas?

Andy




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

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

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