[15624] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3037 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 13 14:05:39 2000

Date: Sat, 13 May 2000 11:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <958241111-v9-i3037@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 13 May 2000     Volume: 9 Number: 3037

Today's topics:
    Re: 'use integer' causes strange output.. <bernie@fantasyfarm.com>
    Re: A question from Dynamic Whistler <gellyfish@gellyfish.com>
        Arrays (real easy question probably) <oogm_yum spam!_@bigfoot.com>
    Re: Arrays (real easy question probably) (brian d foy)
    Re: concurrent variable names (Tad McClellan)
        counting keys in multi-dimensional hash ref (Eric Smith)
    Re: directory contents showing up ?!? <gellyfish@gellyfish.com>
    Re: directory contents showing up ?!? <danielxx@bart.nl>
    Re: Directory Help in perl (Eric Bohlman)
    Re: Directory Help in perl (Tad McClellan)
    Re: Directory Help in perl <t.rast@iname.com>
    Re: Guess what? the largest online book store Amazon.co <monroy@flashcom.net>
        hash scalar value <Luc-Etienne.Brachotte@wanadoo.fr>
    Re: hash scalar value <lr@hpl.hp.com>
    Re: Help in Perl (Steve)
    Re: Help with dates in Perl <billy@arnis-bsl.com>
    Re: Help with dates in Perl <jbc@west.net>
    Re: Help with dates in Perl <jraff@home.com>
    Re: Help with dates in Perl <tony_curtis32@yahoo.com>
        How do I convert? <strad@mondenet.com>
    Re: How do I convert? <calle@lysator.liu.se>
    Re: How do I convert? <lr@hpl.hp.com>
    Re: Is this new language possible in perl? (Eric Bohlman)
    Re: Is this new language possible in perl? <gellyfish@gellyfish.com>
    Re: Iteration <andy@u2me3.com>
        Number of things in an array? <webmaster@ostas.lu.se>
    Re: Number of things in an array? <M@Papesch.de>
    Re: Number of things in an array? <jbc@west.net>
    Re: Perl for Windows - I'm confused... <gellyfish@gellyfish.com>
        perl reverse interpolations bbfrancis@networld.com
        Problem with server scripting zam74@singnet.com.sg
    Re: Regex Question (hopefully, an educated guess) (Tad McClellan)
    Re: Silencing module warnings. <anmcguire@ce.mediaone.net>
        Telnet Server in Perl <S@mSmith.net>
        Using Net::FTP in a subroutine juump@my-deja.com
        What's this line which Perl added to AUTOEXEC.BAT? <waldo700NOwaSPAM@aol.com.invalid>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 13 May 2000 11:41:27 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: 'use integer' causes strange output..
Message-Id: <3atqhs4qqnau2grmosvjoaj4mpi2fe8iq9@news.supernews.com>

Tom Phoenix <rootbeer@redcat.com> wrote:

} On Thu, 11 May 2000, Tad McClellan wrote:
} 
} >    perldoc perldata
} > 
} > -----------------
} > It is often more readable to use the C<< => >> operator between key/value
} > pairs.  The C<< => >> operator is mostly just a more visually distinctive
} > synonym for a comma, but it also arranges for its left-hand operand to be
} > interpreted as a string--if it's a bareword that would be a legal identifier.
} > -----------------
} > 
} > "legal identifier" is described at the top of perldata.pod.
} > 
} > Strings that start with hyphens are _not_ legal identifiers,
} > so you get no magic quoting. You must do it yourself.
} 
} Well, actually, there's more to the story. 
} 
}     some_func(
} 	-betty => "some value",
} 	-wilma => "another value",
}     );
} 
} The hyphen on each of those lines is interpreted (correctly) as a unary
} negation. The name 'betty' or 'wilma' is implicitly quoted by the big
} arrow, since it is a legal identifier. Then perl applies the unary
} negation to the string. 

Now I'm confused.  The doc says "left-hand operand".  In:
   -betty => ...
what's the "left hand operand" to that '=>'?  I'd have guessed it is the
expression "-betty"... 

Is it just "betty"?  If so, then how is the expression parsed --- that is,
if you were to fully parenthesize that expression so we could see what the
operand of the negation is, what would it be?
   -(betty => "some value)
   -(betty =>) "some value
???

What happens if you do
      1 . betty => "some value"
I just tried it and it sure *acted* as if two things were true:
  1) the 'left operand' to the => was "1 . betty" (since "1betty" ended up
being the "left value" of the =>)
  2) nonetheless, it 'strigified' "betty" without a complaint

So it seems that the parsing/magicification of '=>' is a *little* more
complicated than just 'left operand'.

  /Bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


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

Date: 12 May 2000 22:07:44 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: A question from Dynamic Whistler
Message-Id: <8fhrr0$be4$1@orpheus.gellyfish.com>

On Fri, 12 May 2000 01:18:13 GMT bzooty@my-deja.com wrote:
> Hey. Dynamic Whistler is an information site about DHTML. We're a month
> old and are starting to really get focused on content. We're thinking
> about including PERL resources as well. Our question is:
> 
> What would be the most important resource that an PERL developer would
> hope to find on our site?
> 

Probably a pointer to the Perl FAQ wherein it is described how to spell
the name of the language for starters.

/J\
-- 
I'm a white male, age 18 to 49. Everyone listens to me, no matter how
dumb my suggestions are.
-- 
fortune oscar homer


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

Date: Sat, 13 May 2000 18:32:26 +0100
From: "Eddie" <oogm_yum spam!_@bigfoot.com>
Subject: Arrays (real easy question probably)
Message-Id: <lmgT4.5779$rv6.243066@news1-hme0>

In perl is it possible to have multi-dimensional arrays and how do you
access them?
Is this the right way to access a multi-dimensional array?

                @array[4,3]

And if you can't get multi-dimensional arrays is there a way of emulating
them?
Thanks
Eddie




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

Date: Sat, 13 May 2000 13:50:50 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Arrays (real easy question probably)
Message-Id: <brian-1305001350500001@sri.dialup.access.net>

In article <lmgT4.5779$rv6.243066@news1-hme0>, "Eddie" <oogm_yum spam!_@bigfoot.com> wrote:

>In perl is it possible to have multi-dimensional arrays and how do you
>access them?

see the perldsc man page.

-- 
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ 
  <URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>



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

Date: Sat, 13 May 2000 09:03:59 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: concurrent variable names
Message-Id: <slrn8hqklv.plr.tadmc@magna.metronet.com>


[ Please fix your word-wrap ]


On 13 May 2000 07:44:50 GMT, The WebDragon <nospam@devnull.com> wrote:
>Is there a module or a script I can run that will examine other scripts and tell 
>me which variables they have in common? 


You do not need to know that.


>I have two scripts, which when run concurrently via an index.htm frameset, crash 
>macsbug rather horribly. 
>
>use strict IS in force in BOTH scripts, so I don't think it's namespace 
>pollution. hard to tell .. gonna play with it some more.. not exactly sure 
>what's going on here.


The names of variables in 2 separate programs (even 2 instances
of the same program) have no relationship to each other.

That cannot be the cause of your problem.

Move on to the next windmill  :-)


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


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

Date: 13 May 2000 15:12:35 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: counting keys in multi-dimensional hash ref
Message-Id: <slrn8hqs5r.or8.eric@plum.fruitcom.com>

Given a reference to a hash defined:


$hash_ref = {  
                'AHG' 
                    => {
                         'Sale' => {
                             'Advanced Sale' => 445.35,
                             'Final Sale' => 445.35,
                         },
                         'Payment' => {
                             'first' => 245.35,
                             'second' => 445.35,
                             'third' => 445.35
                         }
                    },
                'ARG' 
                    => {
                         'Sale' => {
                             'Advanced Sale' => 445.35,
                             'Final Sale' => 445.35,
                         },
                         'Payment' => {
                             'first' => 245.35,
                             'second' => 445.35,
                             'third' => 445.35
                         }
                    }
};
print scalar keys %{$hash_ref};
 ... gives an output of `2'

Is it possible to count through thus structure to obtain the number of keys
in say,
%{$hash_ref{ARG}{Payment}}  ?


-- 
Eric Smith
eric@fruitcom.com


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

Date: 12 May 2000 21:51:10 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: directory contents showing up ?!?
Message-Id: <8fhqru$88d$1@orpheus.gellyfish.com>

On Thu, 11 May 2000 22:44:57 GMT Daniel van den Oord wrote:
> "Makarand Kulkarni" <makarand_kulkarni@My-Deja.com> schreef in bericht
> news:391B02A6.37FC7CB2@My-Deja.com...
>> Daniel van den Oord wrote:
>>
>> > I want to make a CGI script that displays the files in a specified
>> > directory So I don't have to make a database or a HTML thingy I have
>> > to continuously change when a file is changed !! is this possible ???I
>> > know some CGI except that.... 
>>
>> Unless the directory in question was not under DOCUMENT_ROOT
>> you can let the web server do this task for you by setting
>> the Directory indexing ON ( refer to you webserver docs ).
>
> I want to make a  CGI script with a custom layout and extra options like
> show next 20 or previous and stuff so it should be dynamic !!! not like the
> webserver and put it on enable directory browser if standard file isn't
> found !!
> 

Sure.  Read the documentation about opendir()/readdir() etc or even search
for examples of their use in the archive of this group on Deja News.

/J\
-- 
I'm no supervising technician, I'm a technical supervisor.
-- 
fortune oscar homer


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

Date: Sat, 13 May 2000 17:49:07 GMT
From: "Daniel van den Oord" <danielxx@bart.nl>
Subject: Re: directory contents showing up ?!?
Message-Id: <nAgT4.1374$Kk2.15065@Typhoon.bART.nl>

Thank you but first of all I'm not English speaking so my english isn't as
good as yours !!
second of all I allready worked with perl just not with every possible
command !
for example http://195.38.226.149/res.txt
it just doesn't work yet on a NT machine it did work before on a Linux
server !!

Daniel




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

Date: 13 May 2000 14:00:30 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Directory Help in perl
Message-Id: <8fjn5u$lio$3@slb2.atl.mindspring.net>

[dead camel carcass removed from followups]

Luc-Etienne.Brachotte (Luc-Etienne.Brachotte@wanadoo.fr) wrote:
: This loops on all files in the current directory:
: 
: while (<>)
: {
:    #file name in $_
: }

No, not at all.  That will read each line from each of the files named in 
@ARGV, or from standard input if there were no such files.  It won't read 
file names at all.



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

Date: Sat, 13 May 2000 08:59:02 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Directory Help in perl
Message-Id: <slrn8hqkcm.plr.tadmc@magna.metronet.com>

On Sat, 13 May 2000 11:23:41 +0200, Luc-Etienne.Brachotte <Luc-Etienne.Brachotte@wanadoo.fr> wrote:
>CoDoGG a écrit :
>
>> I am writing a perl CGI program, and I want to find a file in the
>> directory.
>
>This loops on all files in the current directory:


No it doesn't.


>while (<>)
>{
>   #file name in $_
>}


It loops through all of the _lines_ of files named as command
line args (or otherwise stuffed into @ARGV).


<> reads lines.

readdir() reads directories.


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


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

Date: Sat, 13 May 2000 13:13:55 +0200
From: Thomas Rast <t.rast@iname.com>
Subject: Re: Directory Help in perl
Message-Id: <391D38F3.830D5A3B@iname.com>



"Luc-Etienne.Brachotte" schrieb:
> 
> CoDoGG a écrit :
> 
> > Could some please help me..
> > I am writing a perl CGI program, and I want to find a file in the
> > directory.
> >
> > Is there a easy way that I could generate a list or a array of filenames
> > of a certain directory to easily loop through and compare.
> >
> > Thanks alot,
> > Co-DoGG
> 
> This loops on all files in the current directory:
> 
> while (<>)
> {
>    #file name in $_
> }

Correct me if I'm wrong, but I think "while (<>) {...}" loops on every
line of every file given on the command line. If there is no such
filename, it loops on STDIN.

Thomas



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

Date: Sat, 13 May 2000 10:03:14 -0500
From: "L. Monroy" <monroy@flashcom.net>
Subject: Re: Guess what? the largest online book store Amazon.com
Message-Id: <391D6EB2.D597ECDB@flashcom.net>

I also found readmedoc.com have a good selection of technical books and they
are slightly cheaper then bookpool.com.

"Paul R. Andersen" wrote:

> I don't want to sound like an advertisement cause I have no interest in
> this place but we have found generally better prices and availability on
> technical books through bookpool.com, YMMV.
>
> Paul
>
> Freelancer wrote:
>
> > I told our secretary order two O'Reilly books Java Enterprise in a
> > Nutshell and
> > Programming the Perl DBI for me. She ordered from Amazon.com instead
> > O'Reilly.
> > Guess what? She got replied said Amazon only has 1 book each on their
> > stock,
> > so they could not sell those two books to us any more.  (^0^)
> >
> > BTW, Amazon.com is the largest online book store in the world.
>
> --
> Paul Andersen
> -- I can please only ONE person per day.
> -- Today is NOT your day.
> -- Tomorrow isn't looking good either.



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

Date: Sat, 13 May 2000 19:30:32 +0200
From: "Luc-Etienne.Brachotte" <Luc-Etienne.Brachotte@wanadoo.fr>
Subject: hash scalar value
Message-Id: <391D9138.F6AF23BD@wanadoo.fr>

I have a hash %test with 2921 pairs in the form of
string => small integer

Recently I tried the following

$test=%test;
print "$test\n";

It prints
2157/4096

What are this numbers? I didin't find the answer anywhere. They are not
the number of keys, nor the number of values. 4096 looks like a page
size or so.
2157 is surely the number of main entries in the hash table, and 4096
the number of entries the table has been currently sized for.




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

Date: Sat, 13 May 2000 10:53:34 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: hash scalar value
Message-Id: <MPG.138736686c1fb1b898aa75@nntp.hpl.hp.com>

In article <391D9138.F6AF23BD@wanadoo.fr> on Sat, 13 May 2000 19:30:32 
+0200, Luc-Etienne.Brachotte <Luc-Etienne.Brachotte@wanadoo.fr> says...
> I have a hash %test with 2921 pairs in the form of
> string => small integer
> 
> Recently I tried the following
> 
> $test=%test;
> print "$test\n";
> 
> It prints
> 2157/4096
> 
> What are this numbers? I didin't find the answer anywhere. They are not
> the number of keys, nor the number of values. 4096 looks like a page
> size or so.
> 2157 is surely the number of main entries in the hash table, and 4096
> the number of entries the table has been currently sized for.

From perldata:

If you evaluate a hash in scalar context, it returns false if the hash 
is empty. If there are any key/value pairs, it returns true; more 
precisely, the value returned is a string consisting of the number of 
used buckets and the number of allocated buckets, separated by a slash. 
This is pretty much useful only to find out whether Perl's internal 
hashing algorithm is performing poorly on your data set. For example, 
you stick 10,000 things in a hash, but evaluating %HASH in scalar 
context reveals "1/16", which means only one out of sixteen buckets has 
been touched, and presumably contains all 10,000 of your items. This 
isn't supposed to happen.

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


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

Date: 13 May 2000 14:28:55 GMT
From: sjlen@ndirect.co.uk (Steve)
Subject: Re: Help in Perl
Message-Id: <slrn8hqepg.s0k.sjlen@zero-pps.localdomain>

On Sat, 13 May 2000 13:32:12 +0400, ringo wrote:
>Hello,
>
>Have anybody script to daily rotate of some .html  pages.
>Please help!!!

On the face of it it sounds asthough a simple Bash or DOS script
could do the trick, but you don't really explain what you want.

-- 
Cheers
Steve              email mailto:sjlen@ndirect.co.uk

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.ndirect.co.uk/~sjlen/

or  http://start.at/zero-pps

 11:43am  up 16 days, 13:44,  4 users,  load average: 1.12, 1.05, 1.01


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

Date: Sat, 13 May 2000 13:27:05 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: Help with dates in Perl
Message-Id: <8fjl6v$m0s$1@nnrp1.deja.com>

In article <391D2CF0.F521D928@HoMe.CoM>,
  CoDoGG <Co_DoGG.NoSPaM@HoMe.CoM> wrote:
> Can someone help me.
>
> I need to find the current date in perl in the format YYYY-MM-DD in
> order to compare it to another date located in a file!!
>

my ($day, $mon, $year) = (localtime(time))[3,4,5];

my $date_string = sprintf "%04d-%02d-%02d", $year+1900, $mon+1, $day;

Do not just copy and paste, first pls read:
perldoc -f time
perldoc -f localtime

Good luck.
Ilja.

P.S. Alse you may find the following modules *very* usefull:

Date::Calc
Date::Manip





Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 13 May 2000 06:43:30 -0700
From: John Callender <jbc@west.net>
Subject: Re: Help with dates in Perl
Message-Id: <391D5C02.9B52BA51@west.net>

CoDoGG wrote:
> 
> I need to find the current date in perl in the format YYYY-MM-DD in
> order to compare it to another date located in a file!!

Research the use of Perl's localtime function:

perldoc -f localtime

Potential gothchas include the fact that the year value you get
back will need to have 1900 added to it, and the month value will
be 0-based, such that Jan = 0, Feb = 1, etc., so you'll probably
need to add 1 to that to get the sort of number you want. You may
also want to have a look at the documentation for sprintf, so you
can pad the month and mday values with a leading 0, if necessary:

perldoc -f sprintf

Good luck!

John


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

Date: Sat, 13 May 2000 15:12:32 GMT
From: "jraff" <jraff@home.com>
Subject: Re: Help with dates in Perl
Message-Id: <AheT4.65870$R4.345066@news1.rdc1.nj.home.com>

The "localtime" and "gmtime" provide all sorts of individual parts of the
date value.
Build any format you want to perform the compare.

Converts a time as returned by the time function to a 9-element array with
the time localized for the standard Greenwich time zone. Typically used as
follows:
    #  0    1    2     3     4    5     6     7     8
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
                                            gmtime(time);
----------------------------------------------------------------------------
--
"CoDoGG" <Co_DoGG.NoSPaM@HoMe.CoM> wrote in message
news:391D2CF0.F521D928@HoMe.CoM...
> Can someone help me.
>
> I need to find the current date in perl in the format YYYY-MM-DD in
> order to compare it to another date located in a file!!
>
> Does anyone have any suggestions
>
> Thanks
> Co-DoGG
>
>




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

Date: Sat, 13 May 2000 16:47:35 GMT
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Help with dates in Perl
Message-Id: <87k8gyz9aw.fsf@shleppie.uh.edu>


[ removed dead group comp.lang.perl ]

>> On Sat, 13 May 2000 10:21:23 GMT,
>> CoDoGG <Co_DoGG.NoSPaM@HoMe.CoM> said:

> Can someone help me.  I need to find the current date in
> perl in the format YYYY-MM-DD in order to compare it to
> another date located in a file!!

> Does anyone have any suggestions

perldoc POSIX     => strftime()

hth
t


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

Date: Sat, 13 May 2000 16:00:50 GMT
From: Anthony John Doyle <strad@mondenet.com>
Subject: How do I convert?
Message-Id: <391D7C9C.10F98BC@mondenet.com>

  
  This is likely an easy question:
  
  I am wanting to read 8 bit characters in from a file
  and I want to convert each of those bytes to its decimal
  equivalent for example from 0 to 255.  I have tried what
  I think are the right ways to do this and many of the
  obvious wrong ways to do this.
  
  How would be the best / proper way to do this?
  
  Thank you
  
  strad@mondenet.com


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

Date: 13 May 2000 18:27:02 +0200
From: Calle Dybedahl <calle@lysator.liu.se>
Subject: Re: How do I convert?
Message-Id: <86zopu4drd.fsf@tezcatlipoca.algonet.se>

>>>>> "Anthony" == Anthony John Doyle <strad@mondenet.com> writes:

>   I am wanting to read 8 bit characters in from a file
>   and I want to convert each of those bytes to its decimal
>   equivalent for example from 0 to 255.  

perl -le 'print for map {ord} split "",<>;' < file
-- 
 Calle Dybedahl, Vasav. 82, S-177 52 Jaerfaella,SWEDEN | calle@lysator.liu.se
     "Surely the 98% of DNA we share with monkeys must be enough to stop
	      people from sinking this low. " -- Frossie, A.S.R


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

Date: Sat, 13 May 2000 10:17:08 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How do I convert?
Message-Id: <MPG.13872deb5d03f59c98aa74@nntp.hpl.hp.com>

In article <86zopu4drd.fsf@tezcatlipoca.algonet.se> on 13 May 2000 
18:27:02 +0200, Calle Dybedahl <calle@lysator.liu.se> says...
> >>>>> "Anthony" == Anthony John Doyle <strad@mondenet.com> writes:
> 
> >   I am wanting to read 8 bit characters in from a file
> >   and I want to convert each of those bytes to its decimal
> >   equivalent for example from 0 to 255.  
> 
> perl -le 'print for map {ord} split "",<>;' < file

That answer is correct.  However, some might consider this a Better Way:

#!/usr/local/bin/perl -w
use strict;
use Benchmark;

$a = join "" => 'a' .. 'z';

timethese(1 << (shift || 0), {
  Ord    => 'my @a = map ord, split // => $a',
  Unpack => 'my @a = unpack "C*" => $a',
});
__END__

Benchmark: timing 16384 iterations of Ord, Unpack...
       Ord:  7 wallclock secs ( 6.70 usr +  0.00 sys =  6.70 CPU) @ 
2445.37/s (n=16384)
    Unpack:  2 wallclock secs ( 1.93 usr +  0.00 sys =  1.93 CPU) @ 
8489.12/s (n=16384)

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


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

Date: 13 May 2000 13:37:19 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Is this new language possible in perl?
Message-Id: <8fjlqf$lio$2@slb2.atl.mindspring.net>

pohanl@my-deja.com wrote:
: back and keep its data intact.  function query (my own term) means you
: can
: ask a component what functions/methods it supports.  Some people group

The usual term for this is "introspection."

: Well, if you look at most cells in your body, you notice that they have
: a cell wall, and inside contains the DNA and other goodies. Things are

Cell *membrane*.  A cell *wall* is a structure found only, AFAIK, in 
plants and related organisms like bacteria (many antibiotics work by 
damaging cell walls).

: passed to the cell through the cell wall.  This is very similar to
: passing variables to a component through an
: interface/function.
: 
: This new language would have components with no constraints on values
: passed to it.
: as for the values, instead of being dedicated to a method in a
: component/class/function, it would be placed on a bloodstream/"bus".
: cells/components would grab it when they have appropriate functions
: that can use it.

This really sounds like a message queue system with the twist that a 
thread/process/component could peek ahead and grab a message that wasn't 
necessarily at the head of the queue.


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

Date: 12 May 2000 21:43:59 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Is this new language possible in perl?
Message-Id: <8fhqef$6qm$1@orpheus.gellyfish.com>

On Fri, 12 May 2000 17:33:41 +0200 Thorbjørn Ravn Andersen wrote:
> pohanl@my-deja.com wrote:
>> 
>> Ok, here are some ideas for the new language...
> 
> Yes.  Perl is Turing complete.
> 
> Could you write a program in your new language for us to see?  

But not here eh ?  The design of new languages doesnt have very much to
do with Perl whatever language the Interpreter or Compiler is written in
and in my experience this will end in tears if pursued here - isnt there
a comp.lang.misc ....

/J\
-- 
Lurlee your song touched me in so many ways......and which way to the can?
-- 
fortune oscar homer


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

Date: Sat, 13 May 2000 14:40:34 +0100
From: "Andy Chantrill" <andy@u2me3.com>
Subject: Re: Iteration
Message-Id: <8fjm5m$2vq$1@plutonium.btinternet.com>

Yup, that's the one ... thanks!




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

Date: Sat, 13 May 2000 16:11:11 +0200
From: Jimmy Lantz <webmaster@ostas.lu.se>
Subject: Number of things in an array?
Message-Id: <391D627F.B45526A9@ostas.lu.se>

Hi,
how do I count the contents of an array ?
I have 
@values
how do I know how many values I got ?
// Jimmy Lantz
I know this is a newbie Q.!


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

Date: Sat, 13 May 2000 15:10:19 GMT
From: Matthias Papesch <M@Papesch.de>
Subject: Re: Number of things in an array?
Message-Id: <20000513.15101900@snoopy.traube.de>


Hi,

@values	=3D (5, 4, 1);

$item_count	=3D @values;		# is 3

$last_index	=3D $#values;		# is 2


@values used in a scalar context gives the number of items in an array

$#values gives the index of the last item in the array

Hope this helps,

Matthias

>>>>>>>>>>>>>>>>>> Urspr=FCngliche Nachricht <<<<<<<<<<<<<<<<<<

Am 5/13/00, 3:11:11 PM, schrieb Jimmy Lantz <webmaster@ostas.lu.se> zum =

Thema Number of things in an array?:


> Hi,
> how do I count the contents of an array ?
> I have
> @values
> how do I know how many values I got ?
> // Jimmy Lantz
> I know this is a newbie Q.!





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

Date: Sat, 13 May 2000 08:12:10 -0700
From: John Callender <jbc@west.net>
Subject: Re: Number of things in an array?
Message-Id: <391D70CA.A4E719F2@west.net>

Jimmy Lantz wrote:
> 
> Hi,
> how do I count the contents of an array ?
> I have
> @values
> how do I know how many values I got ?
> // Jimmy Lantz
> I know this is a newbie Q.!

Such a newbie Q that even an accidental tourist like me can
answer:

$count = @values;

By assigning @values to a scalar (that is, singular) variable,
you put it in a "scalar context". In such a context, an array
returns the number of elements it contains.

A more-explicit way to put an array in scalar context would be to
use the scalar function. This has the advantage that it will work
even in an otherwise-listish (that is, plural) context:

print 'I got ', scalar @values, ' value(s).';

And having said that, a nagging recollection of some Perl guru or
other's rant about the laziness represented by the "value(s)"
construction leads me to rewrite it thusly:

print 'I got ', scalar @values, ' value', 
    scalar @values == 1 ? '' : 's',
    '.';

At which point I realize I've travelled significantly farther
down this road than the original question warranted, so I
(thankfully) stop.

John


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

Date: 12 May 2000 22:43:30 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl for Windows - I'm confused...
Message-Id: <8fhtu2$i8k$1@orpheus.gellyfish.com>

On Fri, 12 May 2000 07:50:15 GMT Lobo wrote:
> Hello there.
> 
> I guess many people must ask and want this, so please if anybody can
> give me some information about...
> 
> I want to install Perl on my computer. I'm currently running Windows
> 98 and this are my questions - things that I'm really worried about:
> 
> 1) Wich one is the best webserver to run perl on windows (free, if
> possible)?
> 

Ask in comp.infosystems.www.servers.ms-windows as this has nothing to
do with Perl.  Setting up various web servers to run Perl programs is
discussed in the ActiveState FAQ.


> 2) Do I HAVE to get ActiveState? I've heard a lot of criticism about
> ActiveState, so I'm really scared. Is there any other kind of Perl for
> Windows?
> 

Sorry I'm not quite sure what you are saying. I have Activeperl on machines
at work and it works fine.  Maybe you could be more specific about this
alleged criticism ?

> 3) I've installed Perl Builder here, wich seems to have a Perl
> interpreter. How is that? If it really have a Perl interpreter, how
> can I update it? If I install this ActiveState it will conflict with
> Perl Builder's interpreter?
> 

I am typing this in vim which also has Perl embedded.  Perl can do that.
I also have a regular Perl interpreter and it is fine.

Just get the ActivePerl and stop worrying.

/J\
-- 
Dear Lord: The gods have been good to me. For the first time in my life,
everything is absolutely perfect just the way it is. So here's the deal:
You freeze everything the way it is, and I won't ask for anything more. If
that is OK, please give me absolutely no sign. OK, deal. In gratitude,
I present you this offering of cookies and milk. If you want me to eat
them for you, give me no sign. Thy will be done.
-- 
fortune oscar homer


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

Date: Sat, 13 May 2000 17:51:06 GMT
From: bbfrancis@networld.com
Subject: perl reverse interpolations
Message-Id: <8fk4m6$65i$1@nnrp1.deja.com>

I need to know of a to build scalars from strings.

For instance say I have a list of scalars of $radio1, $radio2,
$radio3... returned from CGI, but I don't know how many.
And I want to wrap them in an array.

How can I interpolate a string of text into a scalars?

for instance.

for(c=0; $c<$radiocount; $c++)
{
   $radio[$c] = '$radio' . "$C";
   # Here I want the lvalue of $radio1 (ect.) not the string "$radio1";
}


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 14 May 2000 00:47:50 -0700
From: zam74@singnet.com.sg
Subject: Problem with server scripting
Message-Id: <391E5A26.A167B0EC@singnet.com.sg>

This is a multi-part message in MIME format.
--------------53233C41E207B781F2F7DD6D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

I am creating a form whereby users will be able to append a text file(or
create one if they don't have any files) which they have specified in
the form. This text file is stored remotely. I have tried this for my
previous perl script (a different organization) and it worked fine. But
I am not sure why this script is not even creating the text file at the
server side. Can anyone help me and tell me what is wrong with my code??

#!/usr/local/bin/perl5

print "Content-type: text/html\n\n";

if ($ENV{REQUEST_METHOD}eq'GET'){
 $buffer=$ENV{'QUERY_STRING'};
}
else{
 read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}

@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
      ($name, $value) = split(/=/, $pair);
 $pair =~ tr/+/ /;
 $FORM{$name} = $value;
}

$name = "$FORM{'name'}";
$file = "$FORM{'file'}";
$ext = "$FORM{'ext'}";
print "File: $file<br>";
print "Name: $name<br>";
print "Ext: $ext<br>";

open (f, ">/export/companyName/WWW/cgi-bin/news/zammy/$file.$ext") ||
die $!;
$myFile = <f>;
close (f);

print $myFile $name;
print "contents of file<br>$myFile";


Thanks a million in advance!!!

Zam

--------------53233C41E207B781F2F7DD6D
Content-Type: text/x-vcard; charset=us-ascii;
 name="zam74.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for ƒÄ‹Ž¨
Content-Disposition: attachment;
 filename="zam74.vcf"

begin:vcard 
n:;Zam Zam Begum
tel;pager:95213150
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:zam74@singnet.com.sg
fn:Zam Zam
end:vcard

--------------53233C41E207B781F2F7DD6D--



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

Date: Sat, 13 May 2000 08:51:39 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Regex Question (hopefully, an educated guess)
Message-Id: <slrn8hqjur.plr.tadmc@magna.metronet.com>

On Sat, 13 May 2000 08:54:20 GMT, Michael Lahr <m.lahr@cronia.org> wrote:

>this will probably make the regex faster:

That will have absolutely no effect on speed.


>($a,$b,$c)=snmpwalk($community,$ip,$mib);
>if($a=~m/^sysDescrib.+ : (.*)$/o) {
>
>}
>and so on for the 3 vars
>with the o-option perl will compile the pattern only once, 


And if you leave the 'o' off, perl will _still_ compile
the pattern only once.

'o' helps for variable patterns. It has no effect for constant patterns.

>of course
>perl will compile 3 patterns but it seems to be much faster.
                                              ^^^^^^^^^^^^^^
>at least on my machine


Please show us your code for that. 

That should not be happening.

Sounds like a bug to me...


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


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

Date: Sat, 13 May 2000 11:28:10 -0500
From: "Andrew N. McGuire" <anmcguire@ce.mediaone.net>
Subject: Re: Silencing module warnings.
Message-Id: <391D829A.C31C154B@ce.mediaone.net>

Steve wrote:
> 
> What you're talkin about isn't a warning it's the standard
> output from that process.  You can probably change this
> behaviour, but you'll have to read the docs first.

No, I have read the docs, it is coming from a specific
warn() call inside the Find.pm module.  I do not want to
alter the module, I want to squash the warnings from the
module, by redirecting the STDERR.  I have found a way
that works,  It is actually fairly obvious as the concept
is similar to redirection in the shell.  What I am looking
for is an easier way, something perhaps using globs, as
in my second example, but that will squash the warnings from
the module.  Do not just tell me to RTFM, as I have been
here long enough now to know that is the first thing to do.
Or at least if you know what manual to look in, tell me.
I would be happy to know that there is an easier solution
in the documentation.  I have searched the Deja archives,
google, perldoc, camel-book, and more...  I have a way 
that works, I only want a better one, if possible. :-)

Cheers,

anm
-- 
/*-------------------------------------------------------.
| Andrew N. McGuire                                      |
| anmcguire@ce.mediaone.net                              |
`-------------------------------------------------------*/


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

Date: Sat, 13 May 2000 15:22:06 +0100
From: Sam Smith <S@mSmith.net>
Subject: Telnet Server in Perl
Message-Id: <Pine.BSF.4.10.10005131516180.18981-100000@bumper.jellybaby.net>


I have written soemthign which pretends to be a telnet
server in perl. It works fine using inetd to redirect STDIN
and STDOUT and doesn't do anything special with them.

Unfortunately, I also need some of the features of the
telnet spec which inetd doesn't provide (such as the ability
to switch echoing on and off). 

I've had a look through CPAN, but there doesn't appear to be
a telnet server written in perl. Does anyone know of one or
module which I could use / modify to do what I need?


Cheers
Sam
  S@mSmith.net



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

Date: Sat, 13 May 2000 17:38:10 GMT
From: juump@my-deja.com
Subject: Using Net::FTP in a subroutine
Message-Id: <8fk3u0$5fs$1@nnrp1.deja.com>

Using Net::FTP, I've written a simple script to crawl an FTP server
looking for certain files. I think this should be doable with a single
FTP connection, since the subroutine that checks the files in each
directory only needs to look at the directory one time.

What I thought I could do was open the connection in the main part of
the script, and then refer to $ftp (my FTP socket) in the subroutine.
However, the subroutine does not recognize $ftp as anything at all. (The
command $ftp->cwd(...) fails in the subroutine.)

I'm pretty new to Perl, but I thought variables and objects were global
unless declared otherwise.

So what I've had to do is create a new Net::FTP socket each pass through
the subroutine, which through recursion really bogs down the server
until it no longer accepts new connections. (Although I close/quit the
socket before I start the recursion.)

How do I get the subroutine to recognize an FTP socket created in the
main part of the script? Do I need to pass $ftp as a parameter to the
subroutine? And is there some lag between the time I call "$ftp->close;
$ftp->quit;" and the time the server actually closes the connection?

Thanks for any help.

Steve


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 13 May 2000 07:00:34 -0700
From: bjanko <waldo700NOwaSPAM@aol.com.invalid>
Subject: What's this line which Perl added to AUTOEXEC.BAT?
Message-Id: <19b13c48.15fccc27@usw-ex0101-007.remarq.com>

After installing Perl from activestate.com on my Windows 98
platform, the following line was written into my AUTOEXEC.BAT:

SET PATH=C:\Perl\bin\

This seemed to make my computer unbootable.  Does anyone know
the purpose of the line?  What it does do?  Do I need it?


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

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


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