[15600] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3013 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 11 03:05:35 2000

Date: Thu, 11 May 2000 00:05:09 -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: <958028709-v9-i3013@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 11 May 2000     Volume: 9 Number: 3013

Today's topics:
        Auto user creation. <terrence@edlabs.com>
    Re: baby steps with complex hashes of hashes of hashes  <bmb@ginger.libs.uga.edu>
    Re: baby steps with complex hashes of hashes of hashes  <nospam@devnull.com>
    Re: baby steps with complex hashes of hashes of hashes  <uri@sysarch.com>
    Re: baby steps with complex hashes of hashes of hashes  <nospam@devnull.com>
    Re: baby steps with complex hashes of hashes of hashes  <nospam@devnull.com>
        can scalars evaluate as operators? (Eric Pement)
    Re: COBOL subroutines in Perl? <dan@tuatha.sidhe.org>
    Re: Commifying <sturman@netdoor.com>
        Faster Access Time to Random Element <ibmsales@arkansas.net>
    Re: Faster Access Time to Random Element <jeff@vpservices.com>
    Re: Faster Access Time to Random Element <uri@sysarch.com>
    Re: Faster Access Time to Random Element <rrindels@arkansas.net>
    Re: HOW:  I want to set the time... <lr@hpl.hp.com>
        I need help installing Perl <waldo700NOwaSPAM@aol.com.invalid>
        Quit over the use of a script (ot) <home@cordova.net>
    Re: removing carriage returns from a form entry <nospam@devnull.com>
        Running a script on win98-apache 1.3.12 <hassoun@sympatico.ca>
    Re: Running a script on win98-apache 1.3.12 kcyen@my-deja.com
        Simulating web browsers kcyen@my-deja.com
    Re: Strange Characters from Perl Script <chris@cjx.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 11 May 2000 14:10:40 +0800
From: Terrence Wong <terrence@edlabs.com>
Subject: Auto user creation.
Message-Id: <391A4EE0.268D4906@edlabs.com>

Hi,

Need help in adding a user from a cron.
I have a script that adds a user, it goes like this,
`\/usr\/sbin\/useradd $username -g user -d \/home\/school\/$username -p
$mpass -s \/bin\/false`;

however the login fails, indicating that the password is incorrect. The
man useradd shows that I need to use crypt on the password, but my perl
is weak and I need help.

Cheers.
terrence


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

Date: Thu, 11 May 2000 00:14:22 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: baby steps with complex hashes of hashes of hashes of arrays
Message-Id: <Pine.A41.4.10.10005110003530.10276-100000@ginger.libs.uga.edu>

On 11 May 2000, The WebDragon wrote:
 ...
> what I'd REALLY like to be able to do is this: 
> 
> <tr>
> <td align="left">
> <a href="$filename1.zip">$Title1</a><br>
> <a href="$filename2.zip">$Title2</a><br>
> <a href="$filename3.zip">$Title3</a><br>
> </td>
> <td align="right">
> $size1<br>
> $size2<br>
> $size3<br>
> </td>
> <td align="center">
> <a href="$review1.html" target="_new">$rating1</a>
> <a href="$review2.html" target="_new">$rating2</a>
> <a href="$review3.html" target="_new">$rating3</a>
> </td>
> </tr>
 ...

Lines 1-79 are your code in essence ...

    80  ### One approach:
    81  foreach my $GameType ( keys %complextable ) {
    82
    83    my $count = 0;
    84    my %hash = ();
    85
    86    foreach my $mapName ( sort ( keys %{$complextable{ $GameType }} ) ) {
    87      ++$count;
    88      my( $Title, $size, $review, $rating ) =
    89          @{$complextable{ $GameType }{ $mapName }};
    90      push @{$hash{map_name}},  "$mapName.zip";
    91      push @{$hash{title}},     $Title;
    92      push @{$hash{file_size}}, $size;
    93      if ($rating != -1) {
    94        push @{$hash{review}}, "$review.html";
    95        push @{$hash{rating}}, $rating;
    96      }  # if
    97      else {
    98        push @{$hash{review}}, "N/A";
    99        push @{$hash{rating}}, "N/A";
   100      }  # else
   101    }  # foreach mapName
   102
   103    print qq{<tr>\n<td align="left">\n};
   104    for ( 0..--$count ) {
   105      print <<_end_;
   106  <a href="$hash{map_name}->[$_]">$hash{title}->[$_]</a><br>
   107  _end_
   108    }
   109
   110    print qq{</td>\n<td align="right">\n};
   111    for ( 0..$count ) { print qq{$hash{file_size}->[$_]<br>\n} }
   112
   113    print qq{</td>\n<td align="center">\n};
   114    for ( 0..$count ) { print <<_end_;
   115  <a href="$hash{review}->[$_]" target="_new">$hash{rating}->[$_]</a>
   116  _end_
   117    }
   118
   119    print qq{</td>\n</tr>\n};
   120
   121  }  # foreach GameType

I apologize for not getting that down to 3 lines.

GameType
mapName
Title
size

"Yer bustin' my chops here!"  :-)

-- 
Brad



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

Date: 11 May 2000 04:18:00 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: baby steps with complex hashes of hashes of hashes of arrays
Message-Id: <8fdc9o$r2h$0@216.155.32.24>

In article <x7wvl1srx8.fsf@home.sysarch.com>, Uri Guttman 
<uri@sysarch.com> wrote:


 | i love to see newbies sweat!

heh. I can SEE that :D 

 |   TW> #!perl -w
 |   TW> use strict;
 |   TW> use diagnostics -verbose;
 | 
 | remove that during production. the diagnostics module really slows
 | things down

would you believe I've already noticed that? 

(5 brownie points to the person who can name the comedian who originated 
that "would you believe?" thing. (I've forgotten myself but I used to 
know it)) 
 
 |   TW> # good first attempt at creating it by hand, but I still dunno 
 |   how to TW> extract the TW> # data FROM the maps_list.txt file to 
 |   get it in here in the first place!
 | 
 | my last post in some other trhead has the answer for that. actually it
 | works for the single level and you have a 2 level hash of hashes here. i
 | still don't get your input format and structure but i haven't put much
 | time into that. it looks very simple.

it's even simpler now :D ( see thread "MUCH better DATA file formatting 
:) THANK YOU" )

 |   TW> foreach my $GameType (keys %complextable) { 
 |   TW>     print "GameType is $GameType\n";
 |   TW>     foreach my $mapName (sort (keys %{ $complextable{$GameType}})) 
 |   {
 | 
 | good. that is the inner hash loop idiom. learn it well.
 | 
 |   TW>         my($Title, $size, $review, $rating) = @{ 
 |   TW> $complextable{$GameType}{$mapName}};
 | 
 | good, a complex array dereference. you are doing well. i assume your
 | mailer did the bad wrapping. be careful if that is the real format of
 | your code.

yeah, I wonder if it would be worth my time to see if I could change the 
wrapping length. probably not. :D 

thanks, I'm really trying hard to understand this.. you dunno how much I 
love complex stuff.. (I listen to a UK prog band called Ozric Tentacles 
<http://www.execpc.com/~mwerning/> (<-- official unofficial home page 
heh) that you simply can't play in polite company, but it's wonderful 
music if you're into complex things -- try some of the sample MP3's .. 
I'm THOROUGHLY addicted to this band, and they have some 18 cd's out 
now) 
 
 |   TW> as you can see i CAN do it 'backwards' .. but this is not what I 
 |   need 
 |   TW> really.. that maps_list.txt file is over 1400 lines long :D 
 | 
 | just go backwards. start with the same logical loops and work your way
 | in. you first need the gametype parsed out and then loop over the inner
 | data. here is some example code without the parsing stuff (pseudo code):
 | 
 | 
 | #we have $game_type we loop over the lines
 | 
 | 	$game_hash = {} 
 | 
 | 	while ( <GAME_LINE> ) {
 | 
 | 		parse line ;
 | 
 | 		$game_hash->{'title'} = $title ;
 | 		....
 | 
 | 	}
 | 
 | 	$main_hash{ $game_type } = $game_hash ;
 | 
 | so you have a 2 level hahs of hashes here.

ok, filing this for further study.. with the new data formatting in the 
thread I mentioned, this may change. not sure yet. gonna play with it 
some more. :) 

 |   TW> what I'd REALLY like to be able to do is this: 
 | 
 | if you can generate the output above, you can generate html tables. the
 | key to tables is to use lists and do the work later. you can also do
 | some conversion on the fly and map does well there.
 | 
 |   TW> <td align="center">
 |   TW> <a href="$review1.html" target="_new">$rating1</a>
 |   TW> <a href="$review2.html" target="_new">$rating2</a>
 |   TW> <a href="$review3.html" target="_new">$rating3</a>
 |   TW> </td>
 | 
 |   TW> having only THREE cells in the table will make re-draw MUCH 
 |   faster. 
 | 
 | you have 3 hrefs in each of the outer cells. is that right?

yeah, I forgot to set the <br> tags following each, in my example. 

ultimately it's going to be MUCH faster to display 

TR
TD                TD         TD
link/title        size       review/rating
link/title        size       N/A
link/title        size       review/rating
link/title        size       N/A
link/title        size       N/A
/TD               /TD        /TD
/TR
(although it won't be literally written that way in html, this is just 
for display purposes)

than it is to do 

TR TD link /TD TD size /TD TD review/rating /TD /TR
TR TD link /TD TD size /TD TD N/A /TD /TR
TR TD link /TD TD size /TD TD review/rating /TD /TR
TR TD link /TD TD size /TD TD N/A /TD /TR
TR TD link /TD TD size /TD TD N/A /TD /TR

all those table elements make the browser really work hard to show all 
that stuff, however I already know it'll align in a properly created 
table ANYWAY. :D 

(trying to leverage my knowledge of html also, here =)

[snip] 
 | you actually might want to hire someone depending on your time and
 | budget constraints.

heh nooooo, I want to learn how to do this myself so I can hire MYSELF 
out eventually.. that is the 'hidden goal' of all this intensive study, 
but I also find this to be immense fun :) 

really appreciate your continued help here, Uri.. Thanks!

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Thu, 11 May 2000 04:29:51 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: baby steps with complex hashes of hashes of hashes of arrays
Message-Id: <x7ln1hso8y.fsf@home.sysarch.com>

>>>>> "TW" == The WebDragon <nospam@devnull.com> writes:

  TW> (5 brownie points to the person who can name the comedian who originated 
  TW> that "would you believe?" thing. (I've forgotten myself but I used to 
  TW> know it)) 

would you believe tennessee tuxedo?

  TW> yeah, I wonder if it would be worth my time to see if I could change the 
  TW> wrapping length. probably not. :D 

wrong! learn to appreciate good formatting of code. it can make it much
more readable and easier to maintain. a main area is indenting long
expressions and statements. many people will even create another
subroutine just to simplify deeply nested indents. notice how most good
perl hackers use horizontal white space effectively. perl code with all
of its operators scrunched together is exactly what people hate about
perl. proper white space highlights the operator relationships in the
code.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 11 May 2000 05:32:37 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: baby steps with complex hashes of hashes of hashes of arrays
Message-Id: <8fdgll$7q9$0@216.155.32.24>

In article <x7ln1hso8y.fsf@home.sysarch.com>, Uri Guttman 
<uri@sysarch.com> wrote:

 | >>>>> "TW" == The WebDragon <nospam@devnull.com> writes:
 | 
 |   TW> (5 brownie points to the person who can name the comedian who 
 |   originated 
 |   TW> that "would you believe?" thing. (I've forgotten myself but I used 
 |   to 
 |   TW> know it)) 
 | 
 | would you believe tennessee tuxedo?
 | 
 |   TW> yeah, I wonder if it would be worth my time to see if I could 
 |   change the 
 |   TW> wrapping length. probably not. :D 
 | 
 | wrong! learn to appreciate good formatting of code. it can make it much
 | more readable and easier to maintain. a main area is indenting long
 | expressions and statements. many people will even create another
 | subroutine just to simplify deeply nested indents. notice how most good
 | perl hackers use horizontal white space effectively. perl code with all
 | of its operators scrunched together is exactly what people hate about
 | perl. proper white space highlights the operator relationships in the
 | code.

I was more concerned with the USENET standards, which have been hashed 
and rehashed over and over long before this.. 

I'll look into it though, and if my newsreader allows it, I'll see what 
I can do. 

of course I use whitespace in my OWN programs.. that goes without 
saying.. I've seen how useful it is :)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 11 May 2000 05:59:54 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: baby steps with complex hashes of hashes of hashes of arrays
Message-Id: <8fdi8q$bi4$0@216.155.32.24>

In article 
<Pine.A41.4.10.10005110003530.10276-100000@ginger.libs.uga.edu>, Brad 
Baxter <bmb@ginger.libs.uga.edu> wrote:


 | Lines 1-79 are your code in essence ...
 | 
 |     80  ### One approach:
 |     81  foreach my $GameType ( keys %complextable ) {
 |     82
 |     83    my $count = 0;
 |     84    my %hash = ();
 |     85
 |     86    foreach my $mapName ( sort ( keys %{$complextable{ $GameType 
 |     }} ) ) {
 |     87      ++$count;
 |     88      my( $Title, $size, $review, $rating ) =
 |     89          @{$complextable{ $GameType }{ $mapName }};
 |     90      push @{$hash{map_name}},  "$mapName.zip";
 |     91      push @{$hash{title}},     $Title;
 |     92      push @{$hash{file_size}}, $size;
 |     93      if ($rating != -1) {
 |     94        push @{$hash{review}}, "$review.html";
 |     95        push @{$hash{rating}}, $rating;
 |     96      }  # if
 |     97      else {
 |     98        push @{$hash{review}}, "N/A";
 |     99        push @{$hash{rating}}, "N/A";
 |    100      }  # else
 |    101    }  # foreach mapName
 |    102
 |    103    print qq{<tr>\n<td align="left">\n};
 |    104    for ( 0..--$count ) {
 |    105      print <<_end_;
 |    106  <a href="$hash{map_name}->[$_]">$hash{title}->[$_]</a><br>
 |    107  _end_
 |    108    }
 |    109
 |    110    print qq{</td>\n<td align="right">\n};
 |    111    for ( 0..$count ) { print qq{$hash{file_size}->[$_]<br>\n} }
 |    112
 |    113    print qq{</td>\n<td align="center">\n};
 |    114    for ( 0..$count ) { print <<_end_;
 |    115  <a href="$hash{review}->[$_]" 
 |    target="_new">$hash{rating}->[$_]</a>
 |    116  _end_
 |    117    }
 |    118
 |    119    print qq{</td>\n</tr>\n};
 |    120
 |    121  }  # foreach GameType
 | 
 | I apologize for not getting that down to 3 lines.
 | 
 | GameType
 | mapName
 | Title
 | size
 | 
 | "Yer bustin' my chops here!"  :-)


Not hardly, Brad.. that's an impressive piece of work :D 

ok, this I can implement easily and immediately into the cgi-in-progress 
that is ultimately going to allow the user which 'gametype' map listing 
they want to preview. 

I'm playing with the idea of radio buttons for "all maps", "reviewed 
only", and "unreviewed only". shouldn't be too difficult considering 
this context now. 

Very nice trick the use of ++$count .. I'll have to remember that for 
the rest of this bizness I'm working on regarding this. 

Again, you have a ton of Thanks from me. This 'explains' how it works, 
better than any way I've ever found, and I can immediately break it 
apart, and put its pieces to use elsewhere. <grin> 

OK, now I gotta get working on the input business so I don't have to 
build the dagnabbed %complextable by hand :D 

Cheers!

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Thu, 11 May 2000 04:16:47 GMT
From: epement@jpusa.chi.il.us (Eric Pement)
Subject: can scalars evaluate as operators?
Message-Id: <391a30fb.30779437@news.jpusa.net>

I'm working on a Perl script tonight that I need to get finished in a
few hours. Simple question, but I can't find the answer:

  Is there any way to coerce scalar variables to replace operators?
Here's a highly-simplified way of expressing my question.


    if ($both) {
        $oper = "&&"
    } else {
        $oper = "||"
    }
    ....more code....
   
    if ($a $oper $b) {  # 30 lines of code in this block }


What I'm trying to do is to avoid having to duplicate 30 lines of code
in my first if...else blocks.  I would like to have the bottom line be
interpreted as

    if ($a && $b){...}
or 
    if ($a || $b){...}

depending on how the a different variable evaluated somewhat earlier in
the script. I've tried wrapping $oper with eval(), and tried $$oper, and
some other tricks, but I can't seem to figure out how to do it. If
anyone has a solution, please e-mail me directly. Thanks much.


--
Eric Pement <epement@jpusa.org>
executive editor, Cornerstone mag.   Info on SED here:
http://www.cornerstonemag.com        http://www.cornerstonemag.com/sed
939 W. Wilson, Chicago, IL 60640
tel: 773/561-2450, 1-(ext.)2084      fax: 773/989-2076


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

Date: Thu, 11 May 2000 04:07:44 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: COBOL subroutines in Perl?
Message-Id: <kmqS4.83257$hT2.348141@news1.rdc1.ct.home.com>

In comp.lang.perl.misc Dan Sugalski <dan@tuatha.sidhe.org> wrote:
> In comp.lang.perl.modules Doc Shipley <drdoc@mail.utexas.edu> wrote:
>> I'm posting this for a friend stranded in VPN-Land, and I'm not familiar
>> with perl, si please forgive the crosspost....

>>> Is it possible to call a COBOL subroutine in a perl
>>> script? I know I can call a compiled COBOL program,
>>> but what about an interpreted subroutine? 

> If your platform supports it, there's no reason you couldn't have XS code
> written in COBOL instead of C. The big issue would be writing the wrappers
> for it, or convincing the COBOL compiler to spit out what perl wants. (C
> wrappers are easier) PDL does this with Fortran, for example.

I probably ought to be a tad more clear here...

The issue isn't the platform per se, rather it depends on how well the
subroutine calls the C and COBOL compilers spit out can deal with one
another. On some platforms (like OpenVMS) there's a very well-definied
calling sequence and as long as the compilers obey it (and they all do)
one language can call routines written in any other.

On the other hand, some platforms are heavily biased towards one language
(such as C on Unix) or all the compilers play insular little "The world is
all in my language spat out by my compiler" games, in which case things
are usually a lot trickier.

					Dan


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

Date: Wed, 10 May 2000 23:27:17 -0500
From: sturman <sturman@netdoor.com>
Subject: Re: Commifying
Message-Id: <391A36A5.7B7AD6E4@netdoor.com>

Chris Williams wrote:
> 
> ...in the Cookbook...

check http://www.oreilly.com for errata...

st




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

Date: Wed, 10 May 2000 22:13:01 -0500
From: Rodney Rindels <ibmsales@arkansas.net>
Subject: Faster Access Time to Random Element
Message-Id: <391A253D.EB3AB9F0@arkansas.net>

I have a script that accesses a file with  3000 random lines. I am using
mod_perl  and HTML::Mason on a Linux machine with 512MB Ram.  The
question that I have is specific to increasing the access time to the
specific random element in the file. I have also employed the help of
Storable in this scenario. Below is the snippet for this Masonized
script, although perl logic is perl logic.
By default use strict is in effect.
Basically Storable and Strict are the only two modules used.
If you guys could help me to optimize the logic or let me know what you
think abour regarding design flaws I would appreciate it.

Rodney Rindels


<%perl_init>
my $file="/opt/random.txt";
my $cache = "/tmp/random.stor";
my $mtime=(stat($file))[9];
my $hash=retrieve($cache);
if ($hash->{time_stamp} ne $mtime){
  my $counter=1;
  open (FH, $file);
   while (my $line=<FH>) {
   $hash->{$counter}=$line;
   $counter++;
   }
  $hash->{time_stamp}=$mtime;
$hash->{items}=$counter;
  unlink $cache;
  store($hash,$cache);
}
#I know about srand but might have backward compatibility issues with
older perl installs
srand(time ^ $$);
my $phrase=int(rand($hash->{items}));
my $printphrase=$hash->{$phrase};
if ($printphrase eq "") {
$printphrase = "-What a zero value?";
}
</%perl_init>
<% $printphrase %>









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

Date: Wed, 10 May 2000 21:14:28 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Faster Access Time to Random Element
Message-Id: <391A33A4.B51EC98C@vpservices.com>

Rodney Rindels wrote:
> 
> question that I have is specific to increasing the access time to the
> specific random element in the file.

>   open (FH, $file);
>    while (my $line=<FH>) {
>    $hash->{$counter}=$line;
>    $counter++;
> ...
> my $phrase=int(rand($hash->{items}));

I am not by any means knowledgeable about speed issues, but what about
finding the size of the file, choosing a random bit from within the
file, doing a binary read with a seek to that random position then
finding the closest full line to that seek position.  No hash, no
counter, nada!

-- 
Jeff


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

Date: Thu, 11 May 2000 04:21:35 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Faster Access Time to Random Element
Message-Id: <x7og6dsomq.fsf@home.sysarch.com>

>>>>> "RR" == Rodney Rindels <ibmsales@arkansas.net> writes:

  RR>    while (my $line=<FH>) {
  RR>    $hash->{$counter}=$line;
  RR>    $counter++;

a simple question, why are you using integer indexes in a hash? that is
the realm of arrays and by converting to them, you could reduce this
code to a handful of lines.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Thu, 11 May 2000 01:17:07 -0500
From: "Rodney Rindels" <rrindels@arkansas.net>
Subject: Re: Faster Access Time to Random Element
Message-Id: <NesS4.1178$lI.371859@news-west.usenetserver.com>

Great Question. or answer presumably.
I was thinking this way beacuse the user uploads a new file and I had no way
of knowing the # of elements since they
would be changing. So my logic was to place them in the storable with the
number as the key. Then just grab a random
key from the storable cache when they did a file change.
If you could expand further on your idea, I would love to learn something
more.
Rodney
Uri Guttman <uri@sysarch.com> wrote in message
news:x7og6dsomq.fsf@home.sysarch.com...
> >>>>> "RR" == Rodney Rindels <ibmsales@arkansas.net> writes:
>
>   RR>    while (my $line=<FH>) {
>   RR>    $hash->{$counter}=$line;
>   RR>    $counter++;
>
> a simple question, why are you using integer indexes in a hash? that is
> the realm of arrays and by converting to them, you could reduce this
> code to a handful of lines.
>
> uri
>
> --
> Uri Guttman  ---------  uri@sysarch.com  ----------
http://www.sysarch.com
> SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX
Consulting
> The Perl Books Page  -----------
http://www.sysarch.com/cgi-bin/perl_books
> The Best Search Engine on the Net  ----------
http://www.northernlight.com






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

Date: Wed, 10 May 2000 23:48:48 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: HOW:  I want to set the time...
Message-Id: <MPG.1383f7a3a3fcfda598aa54@nntp.hpl.hp.com>

In article <3919D434.D9D4E6F@vpservices.com> on Wed, 10 May 2000 
14:27:16 -0700, Jeff Zucker <jeff@vpservices.com> says...

 ...

> I just know you want a Perl answer to those questions, so:
> 
>    use LWP::Simple;
>    print get( "http://www.google.com/search?q=time server" );

The Perl syntax is OK, but the query string isn't OK.

     print get( "http://www.google.com/search?q=time+server" );

or

     print get( "http://www.google.com/search?q=time%20server" );

:-)

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


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

Date: Thu, 11 May 2000 00:02:18 -0700
From: bjanko <waldo700NOwaSPAM@aol.com.invalid>
Subject: I need help installing Perl
Message-Id: <2b744cbe.4ae0daa4@usw-ex0105-037.remarq.com>

I'm just learning Perl.  I downloaded it from ftp.funet.fi.  I'm
on Windows 98.  When I tried to run configure.com, I got this
error message:

"This program requires more conventional memory.  Unload drivers
of memory-resident programs that use conventional memory, or
increase the value for Minimum Conventional Memory in the
program's Memory properties sheet."

I have 128MB RAM and this was after a fresh reboot.  I don't
know much about hardware so I don't know how to "increase the
value for Minimum Conventional Memory in the program's Memory
properties sheet."

Please tell me how I can install Perl on my system.

* 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: Thu, 11 May 2000 00:40:59 -0600
From: Peter <home@cordova.net>
Subject: Quit over the use of a script (ot)
Message-Id: <391A55FB.960EF8EA@cordova.net>

Hello,

Pardon the off-topic intrusion but I'm one of those programmers who has
never worked with other programmers and so where do I go to learn the
state of the marketplace.

My bosses continue to use scripts that I have no respect for.  Not
necessarily because
they don't do what there were intended for, but because they are like
patchwork,imho.

I liked to build websites where scripts rotate around the use of
modules.  My bosses began the company by patching together websites with
the 'freeware' scripts and they are fond of these scripts ... yet they
hired me for the ability to handle any type of web programming.

On a regular basis a boss will jump in and put a script in a site and
use one of those scripts to handle the output ... recently they asked me
to make some changes to the script and I just didn't want to do it. I
did not like what I considered an alien intruding in my universe.  I did
not want to waste my time working within the confines  of this alien
entity ... I've modularized so much of what these things do and I do
nearly all my work with the mysql database as my data repository ... and
this thing just ... well it just pisses me off.

Am I a prima donna?  Do the rest of you have to make do with scripts
that you reckon should go into the dustbin and be re-written?

Please don't hesitate to say what you think and pardon the off-topic
intrusion.

Peter


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

Date: 11 May 2000 06:08:27 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: removing carriage returns from a form entry
Message-Id: <8fdior$bi4$1@216.155.32.24>

In article <391A2F7F.39F9@modulus.com.au>, phill@modulus.com.au wrote:

 | > gah, I feel so stupid. :)
 | s/stupid/uninformed/.
 | see the docs for perlop, search for tr, take note of the /d modifier.

heh. thanks :)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Thu, 11 May 2000 04:08:05 GMT
From: Hassoun <hassoun@sympatico.ca>
Subject: Running a script on win98-apache 1.3.12
Message-Id: <391A319C.43F3779@sympatico.ca>

hi

i am trying to exectute locally the following script on my pc, but to no
avail: the html file  is a form that calls the perl script thru the POST
method.

settings: apache 1.3.12 on win98
Perl : ActiveState 5.6.0

any clues?
tia
Hassoun

################Perl file####################
#!C:/Perl/bin/perl

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

print "Data list:<hr>\n";

%form=&receivepost;

foreach (keys(%form))
{print "$_ : $form{$_} <br>\n";}

################################################
sub receivepost
{
	local(%postdata)=();
	local ($len,$d,$data,$name,$value)=();

	$len=$ENV{'CONTENT_LENGTH'};
	$data='';

	if (read(STDIN,$data,$len) !=$len)
	{die("Error reading 'POST' data\n");}

	foreach $d (split('&',$data))
	{
		($name,$value)=split('=',$d);
		$name=&url_decode($name);
		$value=&url_decode($value);

		$postdata{$name}=$value;
	}
	return %postdata;
}

################################################
sub url_decode 
{
	local ($s)=@_;
	$s=~ tr/+/ /;
	$s=~ s/%([0-9A-F][0-9A-F])/pack("C",oct("0x$1"))/ge;
	return ($s);
}
################################################


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

Date: Thu, 11 May 2000 04:52:35 GMT
From: kcyen@my-deja.com
Subject: Re: Running a script on win98-apache 1.3.12
Message-Id: <8fdeae$tob$1@nnrp1.deja.com>

In article <391A319C.43F3779@sympatico.ca>,
  Hassoun <hassoun@sympatico.ca> wrote:
> hi
>
> i am trying to exectute locally the following script on my pc, but to
no
> avail: the html file  is a form that calls the perl script thru the
POST
> method.
>
> settings: apache 1.3.12 on win98
> Perl : ActiveState 5.6.0
>
> any clues?
> tia
> Hassoun
>
> ################Perl file####################
> #!C:/Perl/bin/perl
>
> print "Content-type: text/html\n\n";
>
> print "Data list:<hr>\n";
>
> %form=&receivepost;
>
> foreach (keys(%form))
> {print "$_ : $form{$_} <br>\n";}
>
> ################################################
> sub receivepost
> {
> 	local(%postdata)=();
> 	local ($len,$d,$data,$name,$value)=();
>
> 	$len=$ENV{'CONTENT_LENGTH'};
> 	$data='';
>
> 	if (read(STDIN,$data,$len) !=$len)
> 	{die("Error reading 'POST' data\n");}
>
> 	foreach $d (split('&',$data))
> 	{
> 		($name,$value)=split('=',$d);
> 		$name=&url_decode($name);
> 		$value=&url_decode($value);
>
> 		$postdata{$name}=$value;
> 	}
> 	return %postdata;
> }
>
> ################################################
> sub url_decode
> {
> 	local ($s)=@_;
> 	$s=~ tr/+/ /;
> 	$s=~ s/%([0-9A-F][0-9A-F])/pack("C",oct("0x$1"))/ge;
> 	return ($s);
> }
> ################################################
>

firstly where is your Apache document root and where did you put your
html files ? it is suppose to reside in the document root.


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


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

Date: Thu, 11 May 2000 04:50:16 GMT
From: kcyen@my-deja.com
Subject: Simulating web browsers
Message-Id: <8fde64$tgv$1@nnrp1.deja.com>

Anyone have any perl tools that i can use to
simulate a web browser ?
Better still any ideas on how do i simulate the
way Netscape generate the SSJS session key in
perl?
Thank you.


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


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

Date: Thu, 11 May 2000 07:55:25 +0100
From: Chris Allen <chris@cjx.com>
Subject: Re: Strange Characters from Perl Script
Message-Id: <C4419C930840336A.EF3AB7441A48E79B.8E216AADAC989FE7@lp.airnews.net>

"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:

>This line:
>
>    $value =~ s/<([^>]+)>//gi;
>
>...will kill almost all html tags. There
>are some lame brain tricks to get around
>this but none all that serious if you
>address 'double up brackets' such as:
>...and similar. My choice is to deal with
>people who pull these tricks in rather 
>harsh and imaginative ways. 

From one of my sites:

<!-- The following lines deal with resistance 
values where R1 >= 1000 ohm -->

Is this a lame brain trick?

What would be your harsh and imaginitive way of dealing
with me after finding this unacceptable code on my site?


* You find a scroll labelled THARR


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

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


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