[7899] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1524 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 22 18:07:40 1997

Date: Mon, 22 Dec 97 15:00:26 -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           Mon, 22 Dec 1997     Volume: 8 Number: 1524

Today's topics:
     Re: $* warning even though I didn't use it <rootbeer@teleport.com>
     Dynamic Perl5.004_04 on IRIX How-To <bugaj@bell-labs.com>
     Error using backticks with "ps" system command <Brett.W.Denner@lmco.com>
     Re: Evaluate blank text? <rootbeer@teleport.com>
     Re: extracting data from a file to be put in a variable (Martien Verbruggen)
     Re: extracting data from a file to be put in a variable (Martien Verbruggen)
     Re: Fast Suggestions for this string manipulation probl <shadowweb@worsdall.demon.co.uk>
     Re: Fast Suggestions for this string manipulation probl (brian d foy)
     Re: Fast Suggestions for this string manipulation probl (Martien Verbruggen)
     How to check files exists and if it does then? <shadowweb@worsdall.demon.co.uk>
     Re: How to check files exists and if it does then? (brian d foy)
     Re: How to check files exists and if it does then? <bugaj@bell-labs.com>
     Re: Mini Critiques (Martien Verbruggen)
     Re: next == continue?? (Andrew M. Langmead)
     Re: next == continue?? <reibert@mystech.com>
     Perl 5.004_04 on MP-RAS problems. (jason m. laughman)
     Re: Perl compiler (Clay Irving)
     Perl fails to update file under Peer Web Server... <moises@texas.net>
     Re: Perl fails to update file under Peer Web Server... (brian d foy)
     Re: PERL Manual (Clay Irving)
     Perl programming position available <kellym@webpromote.com>
     Perl5 for DEC Alpha NT <kkfong@clarify.com>
     Re: Possible bug with garbage collector? <reibert@mystech.com>
     Re: Possible bug with garbage collector? <reibert@mystech.com>
     Re: Possible bug with garbage collector? <rootbeer@teleport.com>
     Re: Possible bug with garbage collector? (Ilya Zakharevich)
     Re: Regular Expression Question - non greedy match <#@qz.to>
     Simple Perl (?) Script... (PHoliday99)
     Re: Simple Perl (?) Script... <bugaj@bell-labs.com>
     Re: Socket communication between Perl and C <rootbeer@teleport.com>
     Re: sorting multi-dimensional array (Bennett Todd)
     Re: sorting multi-dimensional array (Gabor)
     Re: sorting multi-dimensional array (Todd O'Boyle)
     Re: Stand-Alone Computer (Richard Steinberg)
     Re: Which language pays most 17457 -- C++ vs. Java? (Peter Seebach)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 22 Dec 1997 13:47:31 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Gabor <gabor@vinyl.quickweb.com>
Subject: Re: $* warning even though I didn't use it
Message-Id: <Pine.GSO.3.96.971222134437.14345b-100000@user2.teleport.com>

On 22 Dec 1997, Gabor wrote:

> Use of $* is deprecated at /usr/home/gabor/bin/logstats.pl line 64.
> #!/usr/local/bin/perl -w
> [snip]
> line 64 >    print <<"PROG_USAGE";
> [snip]
> 
> so what gives?  I don't get it, why the warning, I never use $*
> anywhere in my code.

Somehow, perl thinks it is being used, or at least referenced. Since
you're interpolating, I'd look closely at any dollar signs within the
here-document to see whether one of them might be in front of an asterisk.
Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 22 Dec 1997 17:08:58 -0500
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
Subject: Dynamic Perl5.004_04 on IRIX How-To
Message-Id: <349EE4FA.167E@bell-labs.com>

How to build Perl 5.004_04 for IRIX, reliably, even on tweaked
out workstations like mine, and be able to compile a dynamic
libperl and use the system malloc for use with JPL.  Yeah I was
forgetting to set the LD_LIBRARY_PATH to include cwd, but I also 
was bailing on db.h, and I'm still not sure why the CPAN source 
went into an infinite loop when I tried to compile that... Also, 
no idea why gcc bailed so hard on me, it didn't get half as far
as cc.  Ah well, this works... 

Here ya go (thanks go to Scott Henry):

1) Go here:

http://reality.sgi.com/scotth/info/perl5.html

2) Read the page.  Download: 
Freeware Perl5.004 for IRIX-6.2 w/shared libperl.so  
(or the 5.3 version if you should be so unfortunate)

3) untar the tardist into a working directory

4) run inst and choose install from (1) [the directory you
unpacked into], step (9) through and install just the source,
conflicts (10) just to be sure, go (5).

(If you don't want to use system malloc for JPL and such, 
install this entire dist, or the use the non-dynamic version 
which is also at Scott's site, and stop here.)

5) go to the directory /usr/freeware/src/perl5.00404

6) edit configure.sh so that:
mallocobj=''
mallocsrc=''
malloctype='void *'
usemymalloc='n'

7) type versions | grep UCBdb and if you have Berkeley DB, fine,
if not you'll need to: 
remove DB_File from the 'dynamic_ext' and 'extensions' in config.sh
 or
go here:
 https://www.sgi.com/TasteOfDT/public/freeware2.0/fw_UCBdb/
and get it.

8) type
	env LD_LIBRARY_PATH={$LD_LIBRARY_PATH}:`pwd`

9) run sh Configure, don't change anything except the install
path (if you want to), machine name/domain, and email address...

10) make, make install

11) You should be all set.  Now time to try to install the JPL.


LL+P,
Stephan




                    "Do computers think?"
---------------------------------------------------------------
Stephan Vladimir Bugaj, Multimedia Communication Research Dept.
Departmental Website:       http://www.multimedia.bell-labs.com
PGPkey from http://www.pgp.net/wwwkeys.html or other keyservers
Non-Lucent website:     http://www.cthulhu-dynamics.com/stephan
FAQs:     http://www.cthulhu-dynamics.com/tech/metametafaq.html 
---------------------------------------------------------------
    STANDARD DISCLAIMER:My opinions are NOT those of LUCENT
---------------------------------------------------------------
             "Do submarines swim?" - E.W. Dijkstra


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

Date: Mon, 22 Dec 1997 15:29:24 -0600
From: Brett Denner <Brett.W.Denner@lmco.com>
Subject: Error using backticks with "ps" system command
Message-Id: <349EDBB4.44425116@lmco.com>

I have a Perl script that starts up a binary executable file and forks a
separate Perl process to monitor the total cpu time used.  When a certain
amount of CPU time has elapsed, the forked Perl process take steps to stop the
binary executable. The forked process uses the ps system command to determine
the total time used by all the Perl and binary file processes, but something
is not working properly.  Here are the details.

My forked processes obtains the group id using getpgrp:
 
    $pgrp = getpgrp;

It then runs the ps command to determine the cpu time used by all the
processes in the group:

    $max_time = 1000; # (any positive value)

    while(1) {
        chomp(@times = `ps -g$pgrp -o time=`);
        $time = 0;
        foreach (@times) {
            $time += HMStoDEC($_);
        } 
        stop_binary_process() if $time > $max_time;
    }

where HMStoDEC() is a subroutine that converts the HMS format time output from
ps (e.g., 00:02:11.5) to a decimal representation (e.g., 131.5).  The above
sequence is run in a loop that checks the total time ($time) and compares it
with some maximum value ($max_time), and causes my application to exit if
$time gets too large.

    The problem is, the ps command works the first time it is called, and then
returns nothing after that.  ps works fine from the command line, and in other
sample test scripts I've written, just not in my large Perl script I've
describe above.

Does anybody have any ideas?  Please email any responses to me (see below), as
I may not be able to access c.l.p.m for a few days.

Thanks, and Merry Christmas

Brett

P.S. Read the real Christmas story recently?  See Luke 1:5 thru 2:20
    

-- 
 Brett W. Denner                                Lockheed Martin TAS
 Brett.W.Denner@lmco.com                        P.O. Box 748            
 (817) 935-1144 (voice)                         Fort Worth, TX 76101
 (817) 935-1212 (fax)                           MZ 9333


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

Date: Mon, 22 Dec 1997 13:27:16 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: FeckMan <feckman@albany.net>
Subject: Re: Evaluate blank text?
Message-Id: <Pine.GSO.3.96.971222131945.14345W-100000@user2.teleport.com>

On Mon, 22 Dec 1997, FeckMan wrote:

> Thanks for the reply.  For some reason these changes just don't seem to
> work.  I'm testing the form through an old version of AOL (which,
> unfortunately, many of our clients are STILL using).  Even with these
> changes, when I leave the "firstname" field blank AND when I fill it in,
> I'm still routed to the &incomplete1 subroutine.

Many people have posted potential solutions to your problem. You say these
"just don't seem to work." Okay, let's try some simpler stuff.

See if you can tell whether just _one_ variable is set or blank. I'd
recommend using a test like this. 

    # $foo should have been set from form input
    if (defined($foo) and $foo =~ /\S/) {
	print "Yes, there's some text in \$foo.\n";
    } else {
	print "No, \$foo wasn't set, or wasn't set properly.\n";
    }

When you can get that one to work, then you can see about expanding your
test to cover all of the form variables, probably by wrapping that code in
a loop.

If you're not sure what your browser sends from a certain form, set the
form to submit to this URL and see what it says you sent. 

    http://www.teleport.com/cgi-bin/custom/rootbeer/form-vars

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN. Hope this helps!

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 22 Dec 1997 21:21:52 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: extracting data from a file to be put in a variable
Message-Id: <67mllg$5at$1@comdyn.comdyn.com.au>

In article <349DE160.491EA9D6@diagdata.com>,
	Alan Melton <melton@diagdata.com> writes:
> I have a password data file - ascii
> ie  
> bob bobm
> where bob is user and bobm is password
> want to add extra data
> bob bobm 12345 12457 32456

#!/usr/local/bin/perl -w
# ALWAYS use -w

use strict;  # strict is a very good idea.

open(PWDIN, "passwd.txt") or die "Cannot open passwd.txt: $!";
open(PWDOUT, ">passwd_extra.txt") or die "Cannot open passwd_extra.txt: $!";

while (defined(<PWDIN>))
{
	chomp;

	# You might want to replace the following with a sub that
	# sets the extra_data depending on the line

	my $extra_data = "12345 12457 32457";
	print PWDOUT "$_ $extra_data\n";
}

close(PWDOUT);
close(PWDIN);

> and in the perl script, take the extra data and put
> it into a variable so the data in the variable
> would look like 12345 12457 32456

my ($user, $pass, $rest);
my $current_user = "set this to the current user";

open(PWD, "passwd_extra.txt") or die "Cannot open passwd_extra.txt: $!";

while (defined(<PWD>))
{
	chomp;

	($user, $pass, $rest) = split(/\s+/, $_, 3);

	# Now $user has the user code, $pass the password, and $rest 
	# the rest of the line

	# Do something with it here, possibly the next is what you want

	last if ($user eq $current_user);
}

close(PWD);

> and then take the data in the variable and set in an html file
> <INPUT type=hidden name=KEYW2 value="12345 12457 32456"
> how should I do it.?

Use CGI.pm to do this sort of stuff. perldoc CGI.pm should help you.
If you don't want the help of CGI.pm:

open(HTML, ">file.html") or die "Cannot open file.html: $!";

# other print stuff to make it a valid html page

print HTML "<INPUT type=hidden name=KEYW2 value=\"$rest\">";

# other print stuff to close the html page

close(HTML);

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd.       | clothes.
NSW, Australia                      | 


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

Date: 22 Dec 1997 22:22:38 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: extracting data from a file to be put in a variable
Message-Id: <67mp7e$5he$1@comdyn.comdyn.com.au>

In article <67mllg$5at$1@comdyn.comdyn.com.au>,
	mgjv@comdyn.com.au (Martien Verbruggen) writes:

> while (defined(<PWDIN>))
> {
> 	chomp;
> 
> 	# You might want to replace the following with a sub that
> 	# sets the extra_data depending on the line
> 
> 	my $extra_data = "12345 12457 32457";
> 	print PWDOUT "$_ $extra_data\n";
> }

On second thought, rewrite this as:

while ( defined(my $line = <PWDIN>) )
{
	chomp($line);

	my $extra_data = "12345 12457 32457";
	print PWDOUT "$line $extra_data\n";
}

Do the same in the other code snippets.

Martien
-- 
Martien Verbruggen                  | My friend has a baby. I'm writing down
Webmaster www.tradingpost.com.au    | all the noises the baby makes so later
Commercial Dynamics Pty. Ltd.       | I can ask him what he meant - Steven
NSW, Australia                      | Wright


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

Date: Mon, 22 Dec 1997 20:58:48 +0000
From: Mark Worsdall <shadowweb@worsdall.demon.co.uk>
Subject: Re: Fast Suggestions for this string manipulation problem
Message-Id: <l7iUeMAIStn0EwGN@worsdall.demon.co.uk>

>> 1) taos.nj.nec.com
>> 2) ppp534.quebectel.com
>> 
>> and I want to subtract the front word/s from the string, now example 2
>> will change into:-
>> quebectel.com
>
>perhaps you wanted something like:
>   foreach( qw(taos.nj.nec.com ppp534.quebectel.com) )
>       {
>       (undef, $name) = split /\./, $_, 2;
>       print "$name\n";
>       }

I have a problem understanding what the 2 is controlling here. When I
tried:-


   foreach( qw(taos.nj.nec.com ppp534.quebectel.com 1cust53.max28.san-
francisco2.ca.ms.uu.net) )
       {
       (undef, $name) = split /\./, $_, 2;
       print "$name\n";
       }

All that was extracted was the 1st word upto the first '.'

I am trying to in the end get the meaningfull part so all .com address's
will be stripped down to:- quebectel.com (1 word before the '.')

 .co. will strip the address down to 1 word before the '.' unless it is a
demon.co.uk in which case the address is left alone.

My problem gets worse when dealing with .mil as there is usally 2 words
precedding the .mil but not always and then .gov is the same.

This esculates into mayhem when one looks at the .edu and .ac.uk world.

So basically I have deceided just to strip the following:-

# DNS Filters
@dns = (".demon.co.uk", # Filter of all demon users
        ".co.",         # This filters all .co.uk .co.nz etc etc
        ".com.mx",      # Mexican Company's
        ".mil",         # USA Military
        ".net",         # ISP
        ".com");        # Filter of all .com
$numberOfdns = @dns;

So if it is a demon then note is done etc. So any more ideas?
-- 
Mark Worsdall - Yes, it's underpants renewal time of year :)
Home:- jaydeeATworsdall.demon.co.uk  WEB site:- http://www.worsdall.demon.co.uk
Shadow:- webmasterATshadow.org.uk    WEB site:- http://www.shadow.org.uk


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

Date: Mon, 22 Dec 1997 17:36:30 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Fast Suggestions for this string manipulation problem
Message-Id: <comdog-ya02408000R2212971736300001@news.panix.com>
Keywords: from just another new york perl hacker

In article <l7iUeMAIStn0EwGN@worsdall.demon.co.uk>, Mark Worsdall <shadowweb@worsdall.demon.co.uk> wrote:

[there's a missing attribution to me]

>>   foreach( qw(taos.nj.nec.com ppp534.quebectel.com) )
>>       {
>>       (undef, $name) = split /\./, $_, 2;
>>       print "$name\n";
>>       }

>I have a problem understanding what the 2 is controlling here. When I
>tried:-

did you read the documentation on the split function.  it explains
what the 2 does.


>   foreach( qw(taos.nj.nec.com ppp534.quebectel.com 1cust53.max28.san-
>francisco2.ca.ms.uu.net) )
>       {
>       (undef, $name) = split /\./, $_, 2;
>       print "$name\n";
>       }
>
>All that was extracted was the 1st word upto the first '.'

which version of perl are you using?  that bit of code produces

   nj.nec.com
   quebectel.com
   max28.san-francisco2.ca.ms.uu.net

under 5.004, which is what you wanted, isn't it?  i don't see any other
way to read your initial post.  perhaps you need to clarify what you
are trying to do.

-- 
brian d foy                                  <comdog@computerdog.com>
Meta Meta FAQ <URL:http://computerdog.com/Meta_MetaFAQ.html>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 22 Dec 1997 22:28:58 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Fast Suggestions for this string manipulation problem
Message-Id: <67mpja$5he$2@comdyn.comdyn.com.au>

In article <l7iUeMAIStn0EwGN@worsdall.demon.co.uk>,
	Mark Worsdall <shadowweb@worsdall.demon.co.uk> writes:

>>       (undef, $name) = split /\./, $_, 2;

> I have a problem understanding what the 2 is controlling here. When I
> tried:-

perldoc -f split  
(In other words, the entry for the split function in perlfunc says)

=item split /PATTERN/,EXPR,LIMIT

[snip]

If LIMIT is specified and is not negative, splits into no more than
that many fields (though it may split into fewer). 

[snip]

In other words, the above expression splits $_ on dots, in no more
than two fields. It assigns the first field to undef (effectively
discarding it), and assignes the second and final field to $name.

www.somewhere.com  => $name = somewhere.com
aaa.bbb.ccc.ddd.eee => $name = bbb.ccc.ddd.eee

etc.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In a world without fences, who needs
Commercial Dynamics Pty. Ltd.       | Gates?
NSW, Australia                      | 


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

Date: Mon, 22 Dec 1997 21:53:37 +0000
From: Mark Worsdall <shadowweb@worsdall.demon.co.uk>
Subject: How to check files exists and if it does then?
Message-Id: <3oIg6aAhFun0EwUX@worsdall.demon.co.uk>

Hi, I need to be able to check if a file exists and if it does then
append an 'a' unless that exists, in which case I will append a 'b'
unless that exists etc etc etc.

here is the variable:-
$startloc/Logs/$urlpath/$date

Where $date is the filename that has to be checked if exists and if does
the the letter appended as described above.
-- 
Mark Worsdall - Yes, it's underpants renewal time of year :)
Home:- jaydeeATworsdall.demon.co.uk  WEB site:- http://www.worsdall.demon.co.uk
Shadow:- webmasterATshadow.org.uk    WEB site:- http://www.shadow.org.uk


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

Date: Mon, 22 Dec 1997 17:25:02 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to check files exists and if it does then?
Message-Id: <comdog-ya02408000R2212971725020001@news.panix.com>
Keywords: from just another new york perl hacker

In article <3oIg6aAhFun0EwUX@worsdall.demon.co.uk>, Mark Worsdall <shadowweb@worsdall.demon.co.uk> wrote:

>Hi, I need to be able to check if a file exists and if it does then
>append an 'a' unless that exists, in which case I will append a 'b'
>unless that exists etc etc etc.

perhaps the file test operators are what you need...

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
Meta Meta FAQ <URL:http://computerdog.com/Meta_MetaFAQ.html>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Mon, 22 Dec 1997 17:31:49 -0500
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
Subject: Re: How to check files exists and if it does then?
Message-Id: <349EEA55.446B@bell-labs.com>

Mark Worsdall wrote:
> 
> Hi, I need to be able to check if a file exists and if it does then
> append an 'a' unless that exists, in which case I will append a 'b'
> unless that exists etc etc etc.
> 
> here is the variable:-
> $startloc/Logs/$urlpath/$date
> 
> Where $date is the filename that has to be checked if exists and if does
> the the letter appended as described above.
>

try

use File::Copy;
$foo = "$startloc/Logs/$urlpath/";
if(-e "$foo$date")
{ 
   for($v=97; $v<=122; $v++)
   { 
     $a = chr($v);
     next if ($date=~/$a/); 
     copy("$foo$date","$foo$date$a");   
   }
}

Not overwriting the old file, reading the file from the directory
properly, and doing anything actually meaningful with this code 
are left as an exercise to the reader.

etc.etc.etc. terminates at 'z' in the code above.


LL+P,
Stephan


-- 
  
                    "Do computers think?"
---------------------------------------------------------------
Stephan Vladimir Bugaj, Multimedia Communication Research Dept.
Departmental Website:       http://www.multimedia.bell-labs.com
PGPkey from http://www.pgp.net/wwwkeys.html or other keyservers
Non-Lucent website:     http://www.cthulhu-dynamics.com/stephan
FAQs:     http://www.cthulhu-dynamics.com/tech/metametafaq.html 
---------------------------------------------------------------
    STANDARD DISCLAIMER:My opinions are NOT those of LUCENT
---------------------------------------------------------------
             "Do submarines swim?" - E.W. Dijkstra


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

Date: 22 Dec 1997 21:28:34 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Mini Critiques
Message-Id: <67mm22$5at$2@comdyn.comdyn.com.au>

In article <67m235$4au$1@csnews.cs.colorado.edu>,
	Tom Christiansen <tchrist@mox.perl.com> writes:

> 2.  Perl CGI Programming, No Experience Required
[snip]
>     RATING: 1 out of 5 camels.

Why the 1 camel? The review doesn't sound as if you found anything
good with it. More a 0 I'd say :)

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | We are born naked, wet and hungry. Then
Commercial Dynamics Pty. Ltd.       | things get worse.
NSW, Australia                      | 


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

Date: Mon, 22 Dec 1997 21:47:36 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: next == continue??
Message-Id: <ELM1vC.K4D@world.std.com>

sassee@unx.sas.com (Steve Evans) writes:

I have no idea about the "last"/"next" thing. I would guess that it
would have to do with being words that better describe their function
than the C keywords.

> And another thing,
>all the books mention "there is no switch statement, 
>but you can easily write one with if-else".   Why!?
>It's a useful construct, what's the problem adding it??
>You could probably replace many keywords (while, unless, etc)
>with if-else's and goto's, but who'd want to?

It depends on whether you think switch statements were there to
enhance a program readability or to implement a different an entirely
different programming construct.

If you look at C or similar procedural languages from an assembler
programmer's point of view, it may seem that "if" statements are in
the language to implement conditionals and "switch" statements are
there to implement jump tables. If the people creating languages back
then were implementing optimizing compilers, would they have creating
a switch construct?



-- 
Andrew Langmead


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

Date: Mon, 22 Dec 1997 14:48:44 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: next == continue??
Message-Id: <349EE03C.418234F5@mystech.com>

Steve Evans wrote:

> I have a good background in C and ksh, and am
> just starting to learn perl.  I like that it
> looks so much like C, but find it annoying that
> some key words are different.  Does anyone know
> why "break" in C is "last" in perl, and likewise
> "continue" is "next"??  Was there some actual reason,
> or is this just an arbitrary thing?  And another thing,
> all the books mention "there is no switch statement,
> but you can easily write one with if-else".   Why!?
> It's a useful construct, what's the problem adding it??
> You could probably replace many keywords (while, unless, etc)
> with if-else's and goto's, but who'd want to?

Be careful - a language built as an extension of C already exists, it's
called C++. I do, however, agree that a "switch-like" construct would be
nice.

MSR
-----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: 22 Dec 1997 21:36:21 GMT
From: laughman@wutang.acs.ohio-state.edu (jason m. laughman)
Subject: Perl 5.004_04 on MP-RAS problems.
Message-Id: <slrn69tnan.3nl.laughman@soccer.cis.ohio-state.edu>

I just built perl5.004_04 on NCR's MP-RAS 03.01, and it compiled fine, but 
when I run "make test", it bombs on lib/io_sel with the message

select not implemented at ../lib/IO/Select.pm line 259.

Here's the section from Select.pm that it's bombing on (obviously, it's the
line with the select call in it):

sub can_write
{
 my $vec = shift;
 my $timeout = shift;
 my $w = $vec->[VEC_BITS];

 defined($w) && (select(undef,$w,undef,$timeout) > 0)
    ? handles($vec, $w)
    : ();
}

I thought maybe it was a problem with one of the modules that I was building
with perl, but I removed both IO and Socket and am still getting this.

I've tried running "perl harness" as well as "perl lib/io_sel.t" and don't
get anything more informative than the above error.  Any ideas?  Here's
output from "myconfig" if it helps:

Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=svr4.0, osvers=3.0, archname=4850-svr4.0
    uname='hercules hercules 4.0 3.0 4850 pentium(tm)-mca '
    hint=previous, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='/bin/cc', optimize='-O', gccversion=
    cppflags='-I/usr/include -I/usr/ucbinclude -I/usr/local/include'
    ccflags ='-I/usr/include -I/usr/ucbinclude -I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=4, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='/bin/cc', ldflags ='-L/usr/ccs/lib -L/usr/ucblib -L/usr/local/lib -L/usr/gnu/lib'
    libpth=/usr/local/lib /usr/gnu/lib /shlib /lib /usr/lib /usr/ccs/lib /usr/ucblib
    libs=-lnet -lsocket -lnsl -ldbm -ldl -lld -lm -lc -lcrypt -lucb -lx
    libc=/lib/libc.so.1.1, so=so
    useshrplib=true, libperl=libperl.so.4.4
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-Kpic', lddlflags='-G -L/usr/ccs/lib -L/usr/ucblib -L/usr/local/lib -L/usr/gnu/lib'

Any help would be greatly appreciated.

-- 
"It is not true that life is one damn thing after another...  It's one damn 
 thing over and over." -- Edna St. Vincent Malloy


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

Date: 22 Dec 1997 16:41:55 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Perl compiler
Message-Id: <67mmr3$fs9@panix.com>

In <349eb1e2.13114610@news.xs4all.nl> NightLight@webcity.nl.WEGSPAM!!!!!! (Jeroen Kustermans) writes:

>Hello,

Howdy.

>Does anybody have any experience with compiling of Perl-scripts to
>executables in Win95?
>Are there more perl-compilers (or newer versions) than attentioned at
>http://www.perl.com

Like:

  Perl2exe
  http://www.demobuilder.com/perl2exe.htm
  A command line utility for converting perl scripts to exe files.
  This allows you to create stand alone programs in perl that do not 
  require the perl interpreter. You can also ship the EXE file without
  having to ship your perl source code. 

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: Mon, 22 Dec 1997 15:43:17 +0000
From: "Moises G. Solis" <moises@texas.net>
Subject: Perl fails to update file under Peer Web Server...
Message-Id: <349E8A95.B75CD336@texas.net>

I'm hoping someone else has solved this problem.
I'm trying to update a flat file.   My Perl script
works fine while run in a shell.   It fails when I
run it under NT and Peer Web Server.

The directory permissions have been set to read,
write, and delete.   The directory has been set to
read permissions in Peer Web Services under the
directory tab.

Basically, can I append to a flat file under CGI
or is this not allowed?

Thanks in advance.   This problem has been
bothering me for four days.

Moises.



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

Date: Mon, 22 Dec 1997 17:27:11 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl fails to update file under Peer Web Server...
Message-Id: <comdog-ya02408000R2212971727110001@news.panix.com>
Keywords: from just another new york perl hacker

In article <349E8A95.B75CD336@texas.net>, moises@texas.net wrote:

>Basically, can I append to a flat file under CGI
>or is this not allowed?

the CGI doesn't care.  however, you might look at some of the references
in the CGI Meta FAQ or ask this question in a group that discusses
such issues.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
Meta Meta FAQ <URL:http://computerdog.com/Meta_MetaFAQ.html>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 22 Dec 1997 16:44:05 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: PERL Manual
Message-Id: <67mmv5$g89@panix.com>

In <349ED06A.F043EEA5@cks.ssd.k12.wa.us> Jerome O'Neil <joneil@cks.ssd.k12.wa.us> writes:

>I have the perl 5.004_1 docs in an Adobe PDF format if you would like them.  I
>can zip 'em up and email them to you, but it would be rather large.

Links to gzipped and zipped version are found in the sidebar of Perl
Reference <http://reference.perl.com>.

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: Mon, 22 Dec 1997 21:56:58 GMT
From: Kelly Milligan <kellym@webpromote.com>
Subject: Perl programming position available
Message-Id: <349EE405.7BE9B696@webpromote.com>

For any of you perl programmers searching for a  job in the Internet
marketing industry with a rapidly growing firm, look no further...

Searching for someone with a year of experience with Perl, Unix and
HTML.  C/C++ and Java are also a plus.  Relocation to Chicago is
required.  If interested, please email jobs@webpromote.com or visit
www.webpromote.com/jobs for a larger description.




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

Date: Mon, 22 Dec 1997 13:49:53 -0800
From: Kwok Fong <kkfong@clarify.com>
Subject: Perl5 for DEC Alpha NT
Message-Id: <349EE080.EB865C34@clarify.com>

Is there already a binary distribution of Perl5 for Dec Alpha NT?

If not, how difficult is it to build it myself?

Thanks for any info you can shed on this subject.





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

Date: Mon, 22 Dec 1997 13:40:18 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: Possible bug with garbage collector?
Message-Id: <349ED032.36AADB67@mystech.com>

Mark S. Reibert wrote:

> I'm not sure if this is a bug with the garbage collector, or some wierd
> behavior with lvalues and the print operator. Consider the following test
> script:
>
> #begin script
> @lines = (
>   "0 1 2",
>   "0 1 2 3",
> );
>
> $arrayRef = [];
>
> while ( $line = shift @lines ) {
>    my @obj = split( /\s+/, $line );
>   print "\nObj: $obj[3]\n";
>
>   my %hash = (
>     ZERO  => $obj[0],
>     ONE   => $obj[1],
>     TWO   => $obj[2],
>     THREE => $obj[3],
>   );
>   print "Hash: $hash{THREE}\n";
>
>   push( @$arrayRef, \%hash );
>
>   print "Array: $arrayRef->[0]->{THREE}\n";
>   print "Array: $arrayRef->[1]->{THREE}\n";
>   print "Array: $arrayRef->[2]->{THREE}\n";
> }

Uh Oh - with further investigation I have just answered my own question! The
lines

  print "Array: $arrayRef->[0]->{THREE}\n";
  print "Array: $arrayRef->[1]->{THREE}\n";
  print "Array: $arrayRef->[2]->{THREE}\n";

will create the array entries at index 1 and 2 in order to have something in
which to look up the hash key THREE. Therefore, the next time through the
loop, the new hash reference is pushed onto $arrayRef at index 3, not 1 as
desired. Sorry for cluttering the news group - I know that Perl will "spring
things into existence" as required, but it's sometimes unnerving to have
objects come to life in a print statement!

-----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: Mon, 22 Dec 1997 14:10:37 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: Possible bug with garbage collector?
Message-Id: <349ED74C.6397006@mystech.com>

Mark S. Reibert wrote:

> Uh Oh - with further investigation I have just answered my own question! The
> lines
>
>   print "Array: $arrayRef->[0]->{THREE}\n";
>   print "Array: $arrayRef->[1]->{THREE}\n";
>   print "Array: $arrayRef->[2]->{THREE}\n";
>
> will create the array entries at index 1 and 2 in order to have something in
> which to look up the hash key THREE. Therefore, the next time through the
> loop, the new hash reference is pushed onto $arrayRef at index 3, not 1 as
> desired. Sorry for cluttering the news group - I know that Perl will "spring
> things into existence" as required, but it's sometimes unnerving to have
> objects come to life in a print statement!

OK, now I'm back to thinking this is a bug! The last paragraph on page 250 of
the Camel states that references will only spring into existence when needed in
lvalue context. In particular, the Cames states "Nothing would spring into
existence if you were just trying to print out the value." However, this is
exactly what I am observing!

I believe this is a bug, and am boring myself with my own conversation - so does
anyone else have a comment?

TIA,
Mark Reibert
-----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: Mon, 22 Dec 1997 14:18:39 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: Possible bug with garbage collector?
Message-Id: <Pine.GSO.3.96.971222141558.14345g-100000@user2.teleport.com>

On Mon, 22 Dec 1997, Mark S. Reibert wrote:

>   print "Array: $arrayRef->[0]->{THREE}\n";
>   print "Array: $arrayRef->[1]->{THREE}\n";
>   print "Array: $arrayRef->[2]->{THREE}\n";

Did you know that those lines create elements in @$arrayRef, if the values
for indices 0, 1, and 2 aren't already defined? Autovivication at work!
:-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 22 Dec 1997 22:47:47 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Possible bug with garbage collector?
Message-Id: <67mqmj$fg1$1@agate.berkeley.edu>

In article <349ED74C.6397006@mystech.com>,
Mark S. Reibert <reibert@mystech.com> wrote:
> > Uh Oh - with further investigation I have just answered my own question! The
> > lines
> >
> >   print "Array: $arrayRef->[0]->{THREE}\n";
> >   print "Array: $arrayRef->[1]->{THREE}\n";
> >   print "Array: $arrayRef->[2]->{THREE}\n";
> >
> > will create the array entries at index 1 and 2 in order to have something in
> > which to look up the hash key THREE. Therefore, the next time through the
> > loop, the new hash reference is pushed onto $arrayRef at index 3, not 1 as
> > desired. Sorry for cluttering the news group - I know that Perl will "spring
> > things into existence" as required, but it's sometimes unnerving to have
> > objects come to life in a print statement!
> 
> OK, now I'm back to thinking this is a bug! The last paragraph on page 250 of
> the Camel states that references will only spring into existence when needed in
> lvalue context. In particular, the Cames states "Nothing would spring into
> existence if you were just trying to print out the value." However, this is
> exactly what I am observing!

Currently the LHS of -> is an (sp?) lvalue.  This may be changed in
the future, since many people hate it.  

Nobody yet came with a patch, and since 5.005 is almost frozen,
this most probably stay in 5.005.

Ilya


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

Date: 22 Dec 1997 21:35:44 GMT
From: Eli the Bearded <#@qz.to>
Subject: Re: Regular Expression Question - non greedy match
Message-Id: <eli$9712221623@qz.little-neck.ny.us>
Keywords: just another new york perl hacker

Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> Eli the Bearded  <#@qz.to> wrote:
> > It is my opinion that non-greedy repetition is very subtle and tends to
> > expose a large number of programmer bugs. I almost always recommend doing
> > without it.
> > 	$r='#! rnews ';
> > 	$count = s/$r\d+\n((?:(?!$r)#|[^#]+)+)/$r.(length $1)."\n$1"/gse;
> How is it less error-prone than
> 	/$r(\d+\n)(.+?)(?=$r|$)/
> ?

Well, other than your just adding a new set of parens that throw off
the replacement count, I'd use \Z instead of $ to ensure the right
anchoring if /m were ever added to the flags.

I know your point was that "Here is a case were non-greedy regexps
are not harmful, and in fact simplify things considerably." I know.
There is very strong deliberate anchoring around the part that needed
to be captured, which makes non-greedy matching safe. My point was
to show that it could be solved without needing non-greedy matching.

Elijah
------
will probably always be getting in Ilya's hair over this issue


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

Date: 22 Dec 1997 21:33:31 GMT
From: pholiday99@aol.com (PHoliday99)
Subject: Simple Perl (?) Script...
Message-Id: <19971222213300.QAA14018@ladder01.news.aol.com>

Hello...
I'm working on a little project and I've come to the conclusion that I'll need
more than HTML to accomplish what I need to do. I'm assuming that Perl is the
way to go, but I'm open to suggestions. Anyway I have a form, and when the form
is submitted, I want the Script to output a HTML file with the Fields plugged
in.... so if I have a field named NAME, when they hit the submit button, I'd
like to see the Perl script output something like: "Hello, <NAME>". This seems
like it would be a basic little script, but I don't know where to start. Can
anyone help me out? (Possibly a little example that I can modify to fit my
needs?) Thanks in advance.

-Pete Holiday


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

Date: Mon, 22 Dec 1997 17:16:16 -0500
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
Subject: Re: Simple Perl (?) Script...
Message-Id: <349EE6B0.2781@bell-labs.com>

I reccomend going here:

http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html

and checking out CGI.pm.  There are examples there, using CGI.pm,
to do exactly what you want to do... and more.  CGI.pm is great.
I use it for really enormous CGIs, and little tiny ones.

You can get this module from CPAN

http://www.perl.com/CPAN-local/authors/Lincoln_D_Stein/

Also see brian d foy's CGI Meta FAQ, which is available from 
my MetaMeta FAQ:

http://www.cthulhu-dynamics.com/tech/metametafaq.html



LL+P,
Stephan


-- 
  
                    "Do computers think?"
---------------------------------------------------------------
Stephan Vladimir Bugaj, Multimedia Communication Research Dept.
Departmental Website:       http://www.multimedia.bell-labs.com
PGPkey from http://www.pgp.net/wwwkeys.html or other keyservers
Non-Lucent website:     http://www.cthulhu-dynamics.com/stephan
FAQs:     http://www.cthulhu-dynamics.com/tech/metametafaq.html 
---------------------------------------------------------------
    STANDARD DISCLAIMER:My opinions are NOT those of LUCENT
---------------------------------------------------------------
             "Do submarines swim?" - E.W. Dijkstra


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

Date: Mon, 22 Dec 1997 12:54:51 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Melchisedech Bernd <melchi@kalium.HL.Siemens.DE>
Subject: Re: Socket communication between Perl and C
Message-Id: <Pine.GSO.3.96.971222125243.14345S-100000@user2.teleport.com>

On 22 Dec 1997, Melchisedech Bernd wrote:

> - Nothing happens in the client which semms to be waiting for lines to
>   come in from <SOCK>. 

Buffered output? Check out the magical $| variable in the perlvar manpage,
and the corresponding functionality in C. Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!




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

Date: Mon, 22 Dec 1997 20:40:11 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Re: sorting multi-dimensional array
Message-Id: <slrn69tk29.a5q.bet@ritz.mordor.net>

In article <349EC6CC.F5364934@sftek.com>, Ron Feldman wrote:
>I've got data organized like this:
>
>code    country    rate1    rate2    rate3    rate4
>25    turkey    3.40    2.30    1.90    1.40
>64    bahamas    2.50    2.30    2.10    2.09
>108    bahamas    2.20    2.10    1.50    1.20

I'd tend to start off organizing that as an array of arrays. Suppose you had a
text file that looks like the above; you could scan it into such an array with
something like

    use IO::File;
    my(@data);
    my($fi) = IO::File->new("input_file.txt");
    $fi->getline(); # toss the headers
    while ($_ = $fi->getline()) {
	chomp;
	push @data, [split];
    }

So now $data[0] is a reference to an array containing the first record,
$data[0][0] is 25, $data[0][1] is "turkey", $data[1][1] is "bahamas", and so
on.

>I need to sort by the second field for readability, [...]

    my(@sorted) = sort { $a->[1] cmp $b->[1] } @data;

>I also need to be able to do math with
>the rate fields, for instance, taking turkey's rate1 field and adding it
>to bahamas(64)'s rate1 field.

Well, since the country isn't unique, it's not clear what you mean by "taking
turkey's rate1 field". Suppose you were to define it as "the sum of all those
rate1 fields where country == "turkey"; then you could say

    # Accumulate turkey rate1
    my($tmp) = 0;
    for (@data) { $tmp += $_->[2] if $_->[1] eq "turkey"; }
    # Add turkey's accumulated rate1 into bahamas where code==64
    for (@data) { $_->[2] += $tmp if $_->[0] == 64 && $_->[1] eq "bahamas"; }

But I'm really not sure what you want, since you start by saying country isn't
a key, then propose to do something with "turkey's rate1".

-Bennett


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

Date: 22 Dec 1997 21:41:52 GMT
From: gabor@vinyl.quickweb.com (Gabor)
Subject: Re: sorting multi-dimensional array
Message-Id: <slrn69tn9h.olv.gabor@vinyl.quickweb.com>

In comp.lang.perl.misc, Ron Feldman <rfeldman@sftek.com> wrote:
# I've got data organized like this:
# 
# code    country    rate1    rate2    rate3    rate4
# 25    turkey    3.40    2.30    1.90    1.40
# 64    bahamas    2.50    2.30    2.10    2.09
# 108    bahamas    2.20    2.10    1.50    1.20
# etc.
# 
# I need to sort by the second field for readability, but can't make it
# the key since it's not unique.  I also need to be able to do math with
# the rate fields, for instance, taking turkey's rate1 field and adding it
# to bahamas(64)'s rate1 field.
# 

This should work.

#!/usr/local/bin/perl -w
$i = 0;
while(<DATA>) {
    @{$arr[$i++]} = split;
}
# sort on second field and 1st field you can add 3rd field or whatever
@arr = sort { ${@$a}[1] cmp ${@$b}[1] ${@$a}[0] <=> ${@$b}[0] } @arr;
$" = ' ';
for (@arr) {
    print "@$_\n";
}
__END__
25    turkey    3.40    2.30    1.90    1.40
64    bahamas    2.50    2.30    2.10    2.09
108    bahamas    2.20    2.10    1.50    1.20

# I decided I needed a hash of hashes, as described at
# http://www.perl.com/CPAN-local/doc/manual/html/pod/perldsc.html
# 
# so that I could do the sorting and get at the values I need.
# 
# I think I want to create a temporary hash of hashes that is a sorted
# version of the one I'm reading in.
# 
# I've tried a variation on the examples given, like this:
# 
# $this_field = "country";
#    foreach $i (sort { keys %{$HoH{$this_field}{$a}} cmp keys
# %{$HoH{$this_field}
# {$b}} })
# 
# ..but this fails with no specifics.  (It was a pot-shot anyway.)
# 
# Can I sort this the way I want to, or should I create some other sort of
# array?
# 
# Thanks,
# 
# --
# Ron Feldman
# rfeldman@sftek.com
# 
# 
# 

gabor.
--
    #else /* !STDSTDIO */     /* The big, slow, and stupid way */
        -- Larry Wall in str.c from the perl source code


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

Date: 22 Dec 1997 22:09:27 GMT
From: oboyle@cs.purdue.edu (Todd O'Boyle)
Subject: Re: sorting multi-dimensional array
Message-Id: <67moen$2t8@ector.cs.purdue.edu>

[ courtesy copy cc'ed to rfeldman@sftek.com and posted ]

Ron Feldman <rfeldman@sftek.com> contributed:

> code    country    rate1    rate2    rate3    rate4
> 25    turkey    3.40    2.30    1.90    1.40
> 64    bahamas    2.50    2.30    2.10    2.09
> 108    bahamas    2.20    2.10    1.50    1.20
> etc.

> I need to sort by the second field for readability, but can't make it
> the key since it's not unique.  I also need to be able to do math with
> the rate fields, for instance, taking turkey's rate1 field and adding it
> to bahamas(64)'s rate1 field.

> I decided I needed a hash of hashes, as described at

Hmm.  Seems like a HoH is kinda wasteful.  Try this data structure:

## Use the country as a key (as it should be,) and associate a list of
## records for each country.  For each one of the records, we have this
## structure: [ code, rate1, rate2, rate3, rate4 ]
####
%data = (
		  'turkey'  => [ 
                         [ 25, 3.40, 2.30, 1.90, 1.40 ]
					   ],

		  'bahamas' => [
                         [ 64,  2.50, 2.30, 2.10, 2.09 ], 
                         [ 108, 2.20, 2.10, 1.50, 1.20 ]
					   ]
		);

You can now do this:

## [ code, rate1, rate2, rate3, rate4 ]
foreach $key (sort keys %data)
{
	print "country: $key\n";

	foreach (@{ $data{$key} })
	{
		print "code: $$_[0]: $$_[1], $$_[2], $$_[3], $$_[4]\n";
	}
}

I really don't know your application, but you can hopefully squeeze
enough out of this to get what you need.

Hope that helps!

cheers,
-Todd
-- 
Key: ftp://csociety.ecn.purdue.edu/pub/oboyle/oboyle.asc
Fingerprint: DA 83 ED B0 48 79 F4 5D  B2 4D B0 B7 F1 A3 C1 49
Location: 86 54' 29" W / 40 25' 33" N


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

Date: 22 Dec 1997 21:26:48 GMT
From: steinbru@auste654b.aust.tdprs.state.tx.us (Richard Steinberg)
Subject: Re: Stand-Alone Computer
Message-Id: <67mluo$715$1@excalibur.flash.net>

If you want to test web-related Perl scripts, I suggest another server, 
Omnihttpd
http://www.fas.harvard.edu/~glau/httpd/

You will also need Perl for Win 32
http://www.ActiveState.com/

Richard Steinberg
steinbru@auste654b.aust.tdprs.state.tx.us




In article <349E540E.1173@cableinet.co.uk>, eaarmour@cableinet.co.uk says...
>
>All,
>
>1. I am running Windows NT version 4.0, which is not connected to a
>network. I want to run Perl scripts on the machine purely for my own
>personal use and education. As I am a beginner I have no ideas how I can
>achieve this.
>
>2. I have been told that I need MS personal web server. Is this really
>necessary? Is it available free?
>
>
>Regards
>
>Eric



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

Date: 22 Dec 1997 22:20:41 GMT
From: seebs@plethora.net (Peter Seebach)
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <67mp3p$f7h$3@darla.visi.com>

In article <e8Hnv5nD9GA.93@upnetnews04>,
William J. Leary Jr. <Bill_Leary@msn.com> wrote:
>As I've said in several other messages which have forked off this main one,
>it was my understanding that the argument was over the LANGUAGE, not the
>ENVIRONMENT.

There are two languages.  "printf" is as much a part of the C language
as "++" is.  Yes, there's a form of the C language in which there may or
may not be any printf - but in that form, you don't even know where
programs start, so we don't care much.

>The language spec (the part that says 'if means this, = means this, ++ means
>this and so on) doesn't include that standard library jazz or specify that
>things like "memcpy" are reserved words.  The reserved words there are
>things like "if," "for," "switch" and so forth.  In that spec you won't find
>"memcpy" along with "switch" as a reserved word.

No, you find it in a different section, because it is a different *kind*
of reserved word.  (For instance, it is reserved only as an identifier
with external linkage, when reserved at all, or possibly also as a macro
in some cases.)

>The compilers I used (Metaware, Microsoft C/C++, and a few others we
>evaluated but didn't use for production work) all did just what you say.  If
>we targeted DOS or UNIX or what have you, there were definite limitations on
>what we could do.  If we target nothing (or embedded, or whatever option the
>compiler required) we could use any name we felt like for any purpose
>whatever.

True - they were compiling a different language.  The C spec provides
for two very different things, both called C.

-s
-- 
seebs@plethora.net -- I am not speaking for my employer.  Copyright '97
All rights reserved.  This was not sent by my cat.  C and Unix wizard -
send mail for help, or send money for a consultation.  Visit my new ISP
<URL:http://www.plethora.net/> --- More Net, Less Spam!  Plethora . Net


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

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

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