[10584] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4176 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 8 15:07:11 1998

Date: Sun, 8 Nov 98 12:00:24 -0800
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, 8 Nov 1998     Volume: 8 Number: 4176

Today's topics:
    Re: a small question (Larry Rosler)
    Re: a small question <r28629@email.sps.mot.com>
    Re: a small question dennis_marti@yahoo.com
        any simple cookie examples? <dtbaker-@busprod.com>
    Re: Changing @INC (Bart Lateur)
        Command Line Parameters? <ktimlin@erols.com>
    Re: CPAN mirrors using rsync? <derek_sherlock@hp.com>
    Re: CPAN mirrors using rsync? <derek_sherlock@hp.com>
    Re: Denying repeated submissions... (Bart Lateur)
    Re: FIFO vs. async. <r28629@email.sps.mot.com>
        How to run perl scripts written in C++ on windows? <dales@enhanced-performance.com>
    Re: How to run perl scripts written in C++ on windows? <Pap22@erols.com>
    Re: I thought unbound variables were guaranteed to be z <r28629@email.sps.mot.com>
    Re: I thought unbound variables were guaranteed to be z (Ronald J Kimball)
    Re: If -e different then If -d on a Directory, why? <rgoeggel@atos-group.com>
    Re: Netscape equivalent of ASP cdtoad@hotmail.com
    Re: Not to start a language war but.. (Richard Smol)
    Re: Perl "Too Good" for UCLA's CSUA programming competi <marks@webleicester.co.uk>
    Re: Perl at Webjump - lonely perler! (The Tinman)
        Perl script on Unix??? ssery@my-dejanews.com
    Re: Perl script on Unix??? (Tad McClellan)
    Re: Perl Warning Message? <rgoeggel@atos-group.com>
        ref() does not indicate a reference to a scalar. <brannon@quake.usc.edu>
    Re: ref() does not indicate a reference to a scalar. <stevenjm@olywa.net>
    Re: ref() does not indicate a reference to a scalar. <r28629@email.sps.mot.com>
    Re: select case? (Bart Lateur)
    Re: start a program with exec(); <r28629@email.sps.mot.com>
    Re: trouble with grep.... (Tad McClellan)
    Re: trouble with grep.... <damonbrent@earthlink.net>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Sun, 8 Nov 1998 00:47:30 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: a small question
Message-Id: <MPG.10aefa7ea119cd179898fe@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <Pine.GSO.3.96.981107174221.28550A-100000@crusoe.crusoe.net> 
on Sat, 7 Nov 1998 17:43:01 -0500, Jeff Pinyan <jeffp@crusoe.net> 
says...
> Signed or unsigned, C<print 'integer' if $num == int $num;> works too,
> without wasting a regex.

It works without a warning only if $num conforms to Perl's definition of 
a number, which is what the regex is needed to determine.

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


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

Date: Sat, 07 Nov 1998 20:53:29 -0500
From: Tk Soh <r28629@email.sps.mot.com>
To: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: a small question
Message-Id: <3644F973.7625DE6@email.sps.mot.com>

[posted to comp.lang.perl.misc and copy emailed]

Jeff Pinyan wrote:
> Signed or unsigned, C<print 'integer' if $num == int $num;> works too,
> without wasting a regex.

so 'abc' is also an integer?  the '==' operator causes both sides of the expr
to be converted to numbers before making comparison, guess what the numbers are?

-tk


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

Date: Sun, 08 Nov 1998 03:58:43 GMT
From: dennis_marti@yahoo.com
Subject: Re: a small question
Message-Id: <7234tj$boh$1@nnrp1.dejanews.com>

In article <Pine.GSO.3.96.981107174221.28550A-100000@crusoe.crusoe.net>,
  Jeff Pinyan <jeffp@crusoe.net> wrote:

> Signed or unsigned, C<print 'integer' if $num == int $num;> works too,
> without wasting a regex.

$num = "No, it doesn't.";
print 'strings pass this test' if $num == int $num;

Dennis

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Sun, 08 Nov 1998 10:15:17 -0600
From: Dan Baker <dtbaker-@busprod.com>
Subject: any simple cookie examples?
Message-Id: <3645C395.E49C136A@busprod.com>

I'm struggling a bit with learning how to use cookies.... does anyone
have a small example that sets/gets a cookie to post? Or maybe a website
with a quick and dirty explaination? All the books I have mention them,
and the docs show the syntax, but I'm having trouble seeing the big
picture out of context.

My plan is to use cookies to store some variables holding state
information for a web-based perl application where perl routines can't
pass data directly to each other... 

-- 
Thanx, Dan

# If you would like to reply-to directly, remove the - from my username
* no spam please... regulated by US Code Title 47, Sec.227(a)(2)(B)  *


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

Date: Sun, 08 Nov 1998 13:40:11 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Changing @INC
Message-Id: <364696fc.2029918@news.ping.be>

Greg Coit wrote:

>Is there anyway to change the @INC globally? (ie. without altering all
>of our scipts)

I've been struggling with the same problem just this morning. Guess
what: it's in the FAQ. (PERLFAQ8)

For me it was enough to set a PERL5LIB environmental variable to the
directory path. After that, my scripts can all find my private lib
directory without any help.

	Bart.


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

Date: Sun, 08 Nov 1998 12:04:38 -0500
From: Ken Timlin <ktimlin@erols.com>
Subject: Command Line Parameters?
Message-Id: <3645CF26.DD2ED35@erols.com>

Please excuse this if the answer is obvious but how
     do I pass parameters from the command line to my Perl
     script? I want to pass it two strings in the following
     manner:

           /usr/bin/myprogram string1 string2

     When I try this, whatever I pass to my program is
     always interpreted as a file name.

     I'm using Perl 5 on a Sun SPARC-5 running Solaris 2.6.

     Any help is appreciated. Thank You.
  



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

        Ken Timlin
        Richmond, VA.
        ktimlin@erols.com

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


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

Date: Sat, 07 Nov 1998 17:54:08 -0700
From: Derek Sherlock <derek_sherlock@hp.com>
Subject: Re: CPAN mirrors using rsync?
Message-Id: <3644EBB0.BEAECAFC@hp.com>

Hi,

Yes I was aware of that one, but unfortunately our WAN charges are
higher for overseas.  I'm really hoping someone comes up with a site in
North America.  Maybe I'll do a few trial rsync updates from www.iki.fi
in the mean time, to try out the technique.

Thanks,
Derek.

Jarkko Hietaniemi wrote:

> Derek Sherlock <derek_sherlock@hp.com> writes:
>
> > Hi folks,
> >
> > Is there a list anywhere of CPAN mirrors that support the rsync
> > protocol?  Or does anybody know of any in North America?
>
> Well, I don't know of mirrors but will the CPAN master site,
> ftp.funet.fi::CPAN, do?
>
> --
> $jhi++; # http://www.iki.fi/~jhi/
>         # There is this special biologist word we use for 'stable'.
>         # It is 'dead'. -- Jack Cohen



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

Date: Sat, 07 Nov 1998 17:57:01 -0700
From: Derek Sherlock <derek_sherlock@hp.com>
Subject: Re: CPAN mirrors using rsync?
Message-Id: <3644EC5D.61D4DF26@hp.com>

Derek Sherlock wrote:

> Hi,
>
> Yes I was aware of that one, but unfortunately our WAN charges are
> higher for overseas.  I'm really hoping someone comes up with a site in
> North America.  Maybe I'll do a few trial rsync updates from www.iki.fi

 Of course I really meant ftp.funet.fi.  But you knew that!

>
> in the mean time, to try out the technique.
>
> Thanks,
> Derek.
>
> Jarkko Hietaniemi wrote:
>
> > Derek Sherlock <derek_sherlock@hp.com> writes:
> >
> > > Hi folks,
> > >
> > > Is there a list anywhere of CPAN mirrors that support the rsync
> > > protocol?  Or does anybody know of any in North America?
> >
> > Well, I don't know of mirrors but will the CPAN master site,
> > ftp.funet.fi::CPAN, do?
> >
> > --
> > $jhi++; # http://www.iki.fi/~jhi/
> >         # There is this special biologist word we use for 'stable'.
> >         # It is 'dead'. -- Jack Cohen



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

Date: Sun, 08 Nov 1998 13:40:14 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Denying repeated submissions...
Message-Id: <36489b0a.3068549@news.ping.be>

Larry wrote:

>I've written a web page that asks the viewer to submit a choice
>(a vote).  I'd like to be able to prevent the page viewer from
>submitting multiple ballots from one dial-up session.

Add a hidden field to your form. Set the value to something depending on
the current time (try $^T, the script startup time) and maybe $$, to
create something unique.

In the vote, look out for this vote ID. If the user has already used
this form to vote, this ID will be the same, so reject it if it comes in
more than once. So pressing "submit' repeatedly won't generate multiple
votes.

If that person really wants to vote again, he'll have to reload the
form, which will regenerate a new form with a different ID, and all
fields will be blank again. That would help in many cases.

At best, keep track of which vote ID's are valid, so that hackers can't
fake them. A checksum of some sort might help too.

HTH,
Bart.


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

Date: Sat, 07 Nov 1998 21:18:41 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: FIFO vs. async.
Message-Id: <3644FF59.64BEC0F7@email.sps.mot.com>

spam@mail.stumpworld.com wrote:
[...]
> My question is, does anyone have any suggestions about how best to go about
> writing an asynchronous TCP port listener? Using Socket, is there some easy
> way to have it handle multiple connections better that I've overlooked?

The Ilama Book says "...Typical server then fork a server child to handle the
specific connection..."

[...] 

> Please reply via the e-mail at the bottom if possible.

If you can make my mail ready did the trick ;)

-tk


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

Date: Sat, 07 Nov 1998 20:33:39 -0800
From: Dale Sutcliffe <dales@enhanced-performance.com>
Subject: How to run perl scripts written in C++ on windows?
Message-Id: <36451F23.A6A1E31D@enhanced-performance.com>

How to run perl scripts written in C++ on windows 98?

perl scripts work fine, but now I want to create scripts in C++.  how do
I do this?



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

Date: Sun, 8 Nov 1998 00:06:32 -0500
From: "Pap" <Pap22@erols.com>
Subject: Re: How to run perl scripts written in C++ on windows?
Message-Id: <7238tn$mpi$1@autumn.news.rcn.net>

Whats a perl script written in C++?  Is that kinda like a smart blonde girl?

no pun intended.
sorry i know there are a bunch of blondes in here that know perl like they
know the english language (and then some), and I cant do crap.



Dale Sutcliffe wrote in message
<36451F23.A6A1E31D@enhanced-performance.com>...
>How to run perl scripts written in C++ on windows 98?
>
>perl scripts work fine, but now I want to create scripts in C++.  how do
>I do this?
>




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

Date: Sat, 07 Nov 1998 21:06:54 -0500
From: Tk Soh <r28629@email.sps.mot.com>
To: BRANNON@LNC.USC.EDU
Subject: Re: I thought unbound variables were guaranteed to be zero
Message-Id: <3644FC97.42851640@email.sps.mot.com>

[posted to comp.lang.perl.misc and copy emailed]

tbrannon wrote:
> 
> #!/usr/bin/perl -w
> 
> $total_synapses=16;
> $total_branches=24;
> 
> $cluster{size}=4;
> $cluster{amount}{min}=0;
> # *********** the line below does not cause an error because
> # *********** $cluster{amount} is not zero upon program start
> $cluster{amount}{max}=$total_synapses/$cluster{amount};
> 
> for ($c=$cluster{amount}{min}; $c<=$cluster{amount}{max}; ++$c) {
>   print $c,$/;
>   # allocate clusters
>   $incr=$total_branches/$cluster{size};
>   for ($x=0; $x<$total_branches; $x += $incr) {
>     print "$cluster{size} on branch[$x]\n";
>   }
> }
> 
> =head1
> 
> =cut

I am sorry. What's your question again? I saw some weird things in your code,
but not sure how I should comment. At least tell us what you want, please.

-tk


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

Date: Sat, 7 Nov 1998 23:10:31 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: I thought unbound variables were guaranteed to be zero
Message-Id: <1di5bpe.1rps3041kzb1ksN@bay2-58.quincy.ziplink.net>

tbrannon <brannon@quake.usc.edu> wrote:

> Subject: I thought unbound variables were guaranteed to be zero

What is an unbound variable?

Did you mean unitialized?


Here are the relevant bits of your program.  I've added print statements
to show the value of $cluster{amount} at key points.


#!/usr/bin/perl -w

$total_synapses=16;

$cluster{size}=4;

print "$cluster{amount}\n", $cluster{amount}+0, "\n";  # line 7

$cluster{amount}{min}=0;
# *********** the line below does not cause an error because
# *********** $cluster{amount} is not zero upon program start
$cluster{amount}{max}=$total_synapses/$cluster{amount};

print "$cluster{amount}\n", $cluster{amount}+0, "\n";

__END__

Use of uninitialized value at temp line 7.
Use of uninitialized value at temp line 7.

0
HASH(0x10039480)
268670080



Hmm.....  Yep, if you assign a value to a variable, it's no longer
unitialized.  And in a numeric context, the value of a hard reference is
the memory address.


-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sun, 08 Nov 1998 14:11:14 +0100
From: "Ronald Gvggel" <rgoeggel@atos-group.com>
Subject: Re: If -e different then If -d on a Directory, why?
Message-Id: <7245vc$nmv$2@news.pop-stuttgart.de>

Stan Towianski writes:
> 
> Hi,
> 
> Why does -e for a non-existent directory
> return ok but -d returns not ok like I would expect?
> 
> if ( -e "/whatever/path/does/not/exist/" )
>    {
>    print "path does -e\n";
>    }
> else
>    {
>    print "path does NOT -e\n";
>    }
> if ( -d "/whatever/path/does/not/exist/" )
>    {
>    print "path does -d\n";
>    }
> else
>    {
>    print "path does NOT -d\n";
>    }

Here's my output (as expected):

path does NOT -e
path does NOT -d

Maybe the posted example is false,
or your OS is ;-)

Ronald


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

Date: Sun, 08 Nov 1998 08:40:19 GMT
From: cdtoad@hotmail.com
Subject: Re: Netscape equivalent of ASP
Message-Id: <723ldi$oeq$1@nnrp1.dejanews.com>



> Forgive my ignorance, ASP?

A = Active S = Server P = Pages

> > Is there an equivalent of ASP using PERL (or anything) on Netscape's
> > servers?

Livewire on Netscape is close, but a far cry from the flexibility that ASP
give you on an IIS or CHilisoft enabled server.  But if you can run CGI's on
your server why not use Perl?  It does everything ASP or Livewire can do and
better.

-d


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 8 Nov 1998 13:35:16 GMT
From: bl227@cleveland.Freenet.Edu (Richard Smol)
Subject: Re: Not to start a language war but..
Message-Id: <7246mk$lt0$1@pale-rider.INS.CWRU.Edu>


In a previous article, amw@world.std.com (Anita M Wilcox) says:

>Ack!  Not cobol! Yuk!  And you can't do VB on Unix :-)  But
>I'm learning it anyway, to compete in this increasingly
>Gates-ified world.  But I like that I can do Perl on just
>about any platform.

Actually, nowadays Visual Basic *is* possible on Unix. There is a
Java-version of it and you can find it on http://www.vbix.com. I actually
installed it once and had major fun finding out how they actually copied
lots of VBs capabilities in Java... it's also the only time I enjoyed doing
anything in VB ;)

The O.O. version of Cobol is kinda fun... there even is a visual version of
it. But hey, it's still Cobol ;)

Greetz,

RS


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

Date: Sun, 08 Nov 1998 11:58:33 +0000
From: Mark Simonetti <marks@webleicester.co.uk>
Subject: Re: Perl "Too Good" for UCLA's CSUA programming competition...
Message-Id: <36458769.944B0A80@webleicester.co.uk>

I know what I'd do with anything that was "MS" .. ;)

Mark.
--

Rich Morin wrote:

> >From http://www.perl.org/advocacy/chiem.html
>
> Perl "Too Good"
>
> This is a true story. Names have not been changed.
>
>   UCLA's Computer Science Undergraduate Association regularly hosts its
>   programming competition.  Contestants are given six complex problems and
>   have three hours to write programs to solve as many of the problems as
>   possible.  In 1997, the rules stated that any programming language could
>   be used so long as you solved the problem, so then-undergraduate Keith
>   Chiem entered and used Perl.
>
>   Keith did not merely win, he conquered. He solved five of the six problems
>   in the three hours allotted. The second-place two-person team solved only
>   three problems.   They, needless to say, were not using Perl.
>
>   But if you're a UCLA undergraduate contemplating entering the contest and
>   using Perl, don't bother.  After Keith's conquest, Perl was banned from
>   the contest.
>
>   You've got to admire a language that is banned because it makes problems
>   too easy to solve.
>
> These days, Keith is a sysadmin at Yahoo! Inc., and is wondering what to do
> with the copy of Visual C++ that was his prize.
>
> --
> Canta Forda Computer Laboratory       | Prime Time Freeware - quality
> UNIX consulting, training, & writing  | freeware at affordable prices
> +1 650-873-7841                       | +1 408-433-9662   -0727 (Fax)
> Rich Morin, rdm@cfcl.com              | www.ptf.com, info@ptf.com



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

Date: Sun, 08 Nov 1998 14:22:26 +1100
From: an000229@anon.fun.junk.ee (The Tinman)
Subject: Re: Perl at Webjump - lonely perler!
Message-Id: <an000229-0811981422270001@203.34.59.103>

 John Porter said in a very helpful response to my query:
>     <BODY bgcolor="#FFE000" background="bg.gif">
>
> bgcolor AND background, eh?  What's the point?

PLEASE could all html programmers start using this? You will find the
background color is the same color as the majority of the background
image. The reason for this is simple: There are folks out there with
images turned off. If (for example) my text color is flouro green and my
bgcolor not set, if you have images turned off you will not be able to
read the text. If I set my bgcolor to black even if images are off people
can still read my pages.

Even if you do not want to give 'image-less' people a break consider using
it so people can read your page if your background image is slow to load
(or goes haywire)

Always pick a color very similar to your image as this means less
confusion when (if) your background image loads.

Thank-you too to all who answered my plea for help. Your advice is
invaluable...the page SHOULD work properly soon!

CYA!


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

Date: Sun, 08 Nov 1998 09:54:10 GMT
From: ssery@my-dejanews.com
Subject: Perl script on Unix???
Message-Id: <723po3$rjm$1@nnrp1.dejanews.com>

Hi Everyone...

I'm trying to make a perl script to display all machine's condition in the
lab. For example, if I run the script on Unix, it should display...
yyoon:root> perl ypcat.pl  <- ypcat is a file name 112,223,112,0 camp alive
112,223,112,1 udhg alive 112,223,112,2 rudead dead  <- if rudead machine is
dead or not responding ..... ..... 112,223,112,250 lory alive

I started it out like this.
#!/usr/bin/perl
for($i=1;$i<=250;$i++)
{
 ypcat hosts | grep 112,223,112,$i;
 ping 112,223,112,$i;
}

If I run only first line "ypcat hosts | grep 112,223,112,3", it comes with
112,223,112,3 camp

Is there any unix command to display like "112,223,112,3 camp alive"
Or should I use a script to make it possible?
Please, give me any idea or solution for that.
Thank,
Anyway this is my first posting.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Sun, 8 Nov 1998 12:00:19 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Perl script on Unix???
Message-Id: <j7m427.121.ln@flash.net>

Julian Gilbey (J.D.Gilbey@qmw.ac.uk) wrote:

: The | operator in perl means
: logical or, not pipe.


   The | operator in perl means bitwise or

   The || operator in perl means logical or


   See the 'perlop' man page.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 08 Nov 1998 14:16:49 +0100
From: "Ronald Gvggel" <rgoeggel@atos-group.com>
Subject: Re: Perl Warning Message?
Message-Id: <7245vh$nmv$3@news.pop-stuttgart.de>

Abdul Ali writes:
> 
> Hi,
> 
> I'm getting the following Perl warning message: "Use of initialized
> value at fix_it line xx". The "xx" line is:
> $curr = join(/["]/, @FIELDS);.
> 

You have to quote  a ".

$curr = join(/[\"]/, @FIELDS);

Ronald


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

Date: 7 Nov 1998 21:07:43 -0800
From: tbrannon <brannon@quake.usc.edu>
Subject: ref() does not indicate a reference to a scalar.
Message-Id: <ysizsofu7owy.fsf@nunki.usc.edu>

This script does not indicate a reference to a scalar when it reaches
$drone{nap} yet I think $drone{nap} is a reference to a scalar.



#!/usr/bin/perl

$drone{hertz}     {loop}   {20}{100}{incr}        = 5;
$drone{gbarampa}  {loop}   {1e-3}{5e-3}{incr}     = 0.25e-3;
$drone{kratio}    {loop}   {1.5}{10}{multiply}    = 3;
$drone{na}        {loop}   {5}{100}{multiply}     = 5;
$drone{nap}                                       = 'toggle';
$drone{nmdaampa}  {loop}   {0}{2}{incr}           = 0.5;


sub loop {
  print "loop",$/;
}

sub toggle {
  print "toggle", $/;
}

foreach $sim_parm (sort keys %drone) {
  if (ref($drone{$sim_parm}) eq "HASH") {
    foreach $value_manipulator (keys %{$drone{$sim_parm}}) {
      &{$value_manipulator};
    }
  } else {
    print $drone{$sim_parm},$/;
    $r=ref($drone{$sim_parm});
    print $r,$/;
    
  }
}

-- 

  Terrence Brannon * brannon@quake.usc.edu * http://quake.usc.edu/~brannon


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

Date: Sun, 08 Nov 1998 00:30:12 -0800
From: Steven May <stevenjm@olywa.net>
Subject: Re: ref() does not indicate a reference to a scalar.
Message-Id: <36455694.67EAC8A4@olywa.net>

tbrannon wrote:
> 
> This script does not indicate a reference to a scalar when it reaches
> $drone{nap} yet I think $drone{nap} is a reference to a scalar.
> 
> #!/usr/bin/perl
> 
> $drone{hertz}     {loop}   {20}{100}{incr}        = 5;
> $drone{gbarampa}  {loop}   {1e-3}{5e-3}{incr}     = 0.25e-3;
> $drone{kratio}    {loop}   {1.5}{10}{multiply}    = 3;
> $drone{na}        {loop}   {5}{100}{multiply}     = 5;
> $drone{nap}                                       = 'toggle';

This looks like you've assigned the scalar 'toggle' to the hash.  

Now if you had referenced an anonymous scalar.....
 
$drone{nap} = \'toggle';



HTH,

Steve M.
Blackwater-Pacific


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

Date: Sun, 08 Nov 1998 11:52:54 -0500
From: Tk Soh <r28629@email.sps.mot.com>
To: brannon@lnc.usc.edu
Subject: Re: ref() does not indicate a reference to a scalar.
Message-Id: <3645CC5E.11EA2D83@email.sps.mot.com>

[posted to comp.lang.perl.misc and copy emailed]

tbrannon wrote:
> 
> This script does not indicate a reference to a scalar when it reaches
> $drone{nap} yet I think $drone{nap} is a reference to a scalar.
[snip] 
> $drone{nap}                                       = 'toggle';
 
this is just an 'ordinary' creation of a new element in %drone with key 'nap'
and 
(scalar) value 'toggle'. But if you really want to(?), this should give what
you want:

  $drone{nap}                                       = \'toggle';

-tk


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

Date: Sun, 08 Nov 1998 13:40:13 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: select case?
Message-Id: <364799b7.2729607@news.ping.be>

Philip Snyder wrote:

>Hi... I was searching for the equivalent of select case in VB or switch
>in C/C++. Does anyone know of such a thing?
>
>Example:  (a mix of perl and C++)
>
>switch ($test->{type}) {
>  case 0:
>    ...
>    break;
>  case 1:
 ...

Nothing like that in Perl. Thank goodness, the need for that "break" is
extremely messy.

What you must do is something like  "if (){ .. } elsif () { ... }
elsif..."

If you really hate to repeat that $test->{type} expression, there's a
solution: use for($var) to use $_ as an alias for your variable.

	for ($test->{type}) {
		if($_ == 0) {
			...
		} elsif($_ == 1) {
			...
		} else {
			#default
		}
	}

HTH,
Bart.


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

Date: Sat, 07 Nov 1998 21:12:11 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: start a program with exec();
Message-Id: <3644FDD4.10205655@email.sps.mot.com>

Matevz Sernc wrote:
> But my PROBLEM is that the called program cant run with the browsers
> "nobody" user.

Perhaps you should check to make sure the 'called program' have the permission
set to allow the 'world' to run it.

I am surprise Tom P. didn't point you to the CGI FAQ links ;-)

-tk


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

Date: Sat, 7 Nov 1998 21:47:11 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: trouble with grep....
Message-Id: <v74327.kqf.ln@flash.net>

brent verner (damonbrent@earthlink.net) wrote:
: i am trying to remove duplicate items from array...but this doesn't work
: .... seems like it should, could anyone explain to me why this doesn't
: work.

: foreach $item(@array)
: {
:     push @new, $item unless grep /$item/, @new;
: }

: i can 'print grep /$item/, @new;' and see that it returns the number of
: items, but the test isn't allowing a push. i'm *really* confused here... 


   That will not work if you have regex metachars in your @array
   elements.

   It would also not push() 'foo' if 'foobar' was already in
   @new...


   To test for equality, use the operator for testing equality  ;-)


      push @new, $item unless grep $_ eq $item, @new;



   Have you had a look at the answer given for your Frequently
   Asked Question in the Perl FAQ, part 4?

      "How can I extract just the unique elements of an array?"


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 08 Nov 1998 05:18:07 -0500
From: brent verner <damonbrent@earthlink.net>
Subject: Re: trouble with grep....
Message-Id: <36456FDE.E80D63A1@earthlink.net>

brent verner wrote:
> 
> i am trying to remove duplicate items from array...but this doesn't work
> ... seems like it should, could anyone explain to me why this doesn't
> work.
> 
> foreach $item(@array)
> {
>     push @new, $item unless grep /$item/, @new;
> }
> 
> i can 'print grep /$item/, @new;' and see that it returns the number of
> items, but the test isn't allowing a push. i'm *really* confused here...
> 
> thanks,
> brent


thanks to all! i'm rtfming now. it just doesn't make sense why this code
doesn't produce expected results. i ended up using a kludge-hack ---
nested for and eq test to push, but i'd like to see the neat code work.
i'm gonna build that 5.005_02 now i guess...

brent



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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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