[11828] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5428 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 20 11:07:20 1999

Date: Tue, 20 Apr 99 08:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 20 Apr 1999     Volume: 8 Number: 5428

Today's topics:
    Re: (Me Dummy) Have .pl forum script and want to add an <martin@adoma.se>
    Re: [Q] Please help with eval problem <qa3653@email.mot.com>
    Re: CGI/Telnet?? <upsetter@ziplink.net>
    Re: CGI/Telnet?? (Abigail)
    Re: Database structure for a search engine (Benjamin Franz)
    Re: DBM and Perl (Sam Curren)
    Re: for (my $i;;) doesn't work like I think it should (M.J.T. Guy)
        how old is perl 5 <charles@twcny.rr.com>
    Re: how old is perl 5 <Philip.Newton@datenrevision.de>
    Re: How to join two hashes? <tchrist@mox.perl.com>
    Re: How to join two hashes? (Joe McMahon)
    Re: Interpolating Variables for 'use' (M.J.T. Guy)
    Re: Perl cookbook ... (Tad McClellan)
        Perl Minimum Install jayguerette@my-dejanews.com
    Re: Perl notation question? (Larry Rosler)
    Re: Perl notation question? <Philip.Newton@datenrevision.de>
        Removing elements of an array... <fabascal@gredos.cnb.uam.es>
    Re: Removing elements of an array... (Andrew Johnson)
    Re: Removing elements of an array... <charles@twcny.rr.com>
    Re: Removing elements of an array... (Larry Rosler)
    Re: Removing elements of an array... <Philip.Newton@datenrevision.de>
    Re: Sorting Hashes of Arrays.... (Tad McClellan)
        system() call on 5.005_03 <carpioj@warwick.net>
    Re: Tool Reuse Considered Beneficial (was: New FAQ: How <tchrist@mox.perl.com>
    Re: Top 10 newbie errors? (Clinton Pierce)
    Re: Unix files in MacPerl (Dan Wilga)
    Re: Wanna post, need programmer help (Tad McClellan)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 20 Apr 1999 16:19:26 +0200
From: "wooflock" <martin@adoma.se>
Subject: Re: (Me Dummy) Have .pl forum script and want to add an extra (blank) line inbetween..
Message-Id: <7fi3em$do2$1@zingo.tninet.se>


David Cassell wrote in message <371B78E8.C82CE4A3@mail.cor.epa.gov>...

>Don't expect anyone here to be that familiar with arbitrary programs
>written somewhere on this planet in this century.  That's asking a
>lot of any Perl expert, even if he/she is using the PSI::ESP
>module.  :-)
>
>If you just want to add a line that has only a newline, try:
>   print "\n";
>
>If you're doing this for HTML, that's different.  But I can't tell
>from here.


For adding a blank line in HTML
print "<BR>";

or
print "<P></P>";

Best regards Martin Quensel





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

Date: Tue, 20 Apr 1999 09:13:05 -0500
From: Mark Newman <qa3653@email.mot.com>
To: Larry Rosler <lr@hpl.hp.com>, David Alan Black <dblack@email.njin.net>
Subject: Re: [Q] Please help with eval problem
Message-Id: <371C8B71.2B630919@email.mot.com>

Just to clarify this a little bit (based on some email that I received):

This (obviously) is a little snippet of test code.  My main goal is to 
dynamically create the variable name (an array) in a loop, and then
modify 
the contents of that loop.  That is why I am using the eval command
instead
of a simple hash, or array.  

If I do this using separate arrays, it will result in approximately 50
separate loops, 
all doing basically the same thing, just with different array names.

Thanks again, 

Mark

Mark Newman wrote:
> 
> I'm trying to modify the contents of a variable in a loop,
> using the eval command.  When I run this code, I get the following
> error:
> 
> (newmanmb): perl_temp
> 
> Can't modify concatenation in scalar assignment at
> /export/home/newmanmb/perl_temp line 10, near "'Hello There')"
> Execution of /export/home/newmanmb/perl_temp aborted due to compilation
> errors.
> 
> We are using perl 5.004_01.
> 
> I have been able to find a way to do this (see the commented out part at
> the
> end), but I can't understand why this doesn't work.
> 
> Anyone?
> 
> Thanks,
> 
> Mark N
> 
> #!/usr/local/bin/perl
> $test_id0="TRY";
> $test_id1="TO CHANGE";
> $test_id2="ME";
> foreach $variable (0..2) {
>         $tempvar=eval{'$test_id' . $variable};
>         $tempdata=eval $tempvar;
>         printf("Variable name is $tempvar\n");
>         printf("Data in $tempvar is $tempdata\n\n\n");
>         eval("\$test_id" . $variable = 'Hello There');
>         printf("$test_id0\n");
> 
> # THIS WORKS:
> #       $str="\$test_id" . $variable;
> #       eval "$str='Hello There'";
> #       printf("$test_id0\n");
> 
> } #end foreach $variable


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

Date: Tue, 20 Apr 1999 14:43:07 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: CGI/Telnet??
Message-Id: <%n0T2.20$tX1.300@news.shore.net>

Zach Trexler <00205613@bigred.unl.edu> wrote:

: You 
: can either help me, mock me, or ignore me.  It seems you've chosen to 
: mock me, which I expected because I included the magical word "WebTV" 
: in my post. 

Naw, Abby is an equal-opportunity mocker. She makes fun of anyone who
knows less about anything than she does.

--Art



-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: 20 Apr 1999 14:56:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: CGI/Telnet??
Message-Id: <7fi4ig$r84$1@client2.news.psi.net>

Zach Trexler (00205613@bigred.unl.edu) wrote on MMLVIII September
MCMXCIII in <URL:news:7fi18o$jpr@crcnis3.unl.edu>:
%% Abigail (abigail@fnx.com) wrote:
%% : Z Trexler (ztrexler@heehaw.com) wrote on MMLVIII September MCMXCIII in
%% : <URL:news:7fgiqj$d1j$1@nnrp1.dejanews.com>:
%% : {} I own a WebTV, but I am also an intermediate web developer at a university. 
%% : 
%% : Goodie. An intermediate web developer. I guess we get a well phrased, to
%% : the point question, and not a "I wanna do this, and I've no clue where to
%% : start". After all, you are intermediate. And you own a WebTV.
%% 
%% Hey, you're quick.
%%  
%% : {} I want to find a way to write a CGI script that allows me to telnet from my
%% : {} WebTV. Keep in mind that WebTV has no java capabilities, and obviously no
%% : {} built-in telnet program.
%% : 
%% : I suggest you start with studying the telnet protocol, and while you are
%% : doing that, figure out which of the languages supported by WebTV you want
%% : to write your telnet client in.
%% : 
%% : What do you say? WebTV doesn't have support for any language? Well.....
%% : then maybe it's impossible.
%% 
%% No, it's not impossible.  Where did I say WebTV has no support for 
%% _any_ language?   

Nowhere, but I've never heard WebTV does. Please provide us with a list
of embedded languages in WebTV.

%% : {} Apparently someone actually has created one before, at hypermart.com, but it
%% : {} was removed because of heavy traffic.  I never saw it, and have only heard
%% : {} about it.
%% : 
%% : Uhm, yeah. Sure. Did you write hypermart.com about it?
%% 
%% UHM, no, I did not write Hypermart about it.  How would they know 
%% about one little site that no longer exists?  Anyways, I was able to 
%% find someone who had a backup copy of it on an angelfire site.  Try 
%% this:
%% 
%% http://demo69.hypermart.net/Telnet.pl

That of course isn't telnet. It's a form, executing some commands on
the server. Telnet is interactive, a form isn't. Although, after two or
three commands, it only gives 500 errors.

%% And you'll see that you can attempt to log-in to a telnet application, 
%% or something of the sort.  Try logging on to a remote server, though, 
%% and all you get is connected and then promptly disconnected.  Try 
%% this:
%% 
%% http://demo69.hypermart.net/Unix.pl

Unix.pl is extremely dangerous, as it blindly executes whatever the
user puts in the form. Including a 'rm -rf /' or a fork bomb.

%% And you'll get a Unix prompt, albeit limiting.  

No, it's not a Unix prompt. It's a form.

%% : Now, what was your Perl question again?
%% 
%% There has to be a way to alter this script to get it to continually 
%% send input and output back and forth, without it disconnecting.

Yes. It's called "telnet". Which requires something to run at the *client*.
Now, unless WebTV has an embedded Perl interpreter, you shouldn't be
asking here.



Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


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

Date: Tue, 20 Apr 1999 14:36:20 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Database structure for a search engine
Message-Id: <Eh0T2.3858$ep4.48408@typhoon-sf.pbi.net>

In article <7f565p$qi2$1@nnrp1.dejanews.com>,
howitgolook  <howitgolook@my-dejanews.com> wrote:
>I'm not sure how many web pages I will need to store as yet.
>Could you tell me a bit more about inverted indexes?

An inverted index is a database organized such that the things 
you are searching for are the keys of the database and the records
are lists of the documents they appear in. You construct it
by scanning all of your documents, breaking them down into the
components (words in this case) you want to search on and adding
the document identifiers to the the record(s) for each word. When 
you do a search, it then becomes a matter of a direct lookup of the 
word(s) you are searching on.

>If I'm doing a flat search, would there be any way to optimize 
>the process?

Slurp it all into a RAM disk. If you have a lot of RAM available.

>Or could I just search sequentially?

That is the same a flat search.

-- 
Benjamin Franz


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

Date: Tue, 20 Apr 1999 07:42:58 -0700
From: samc@empirewest.com (Sam Curren)
Subject: Re: DBM and Perl
Message-Id: <MPG.1186324fb2e2ff929896ed@news.sonic.net>


> #! /usr/local/bin/perl
> use DB_File;
> use Fcntl;
> require("cgi-lib.pl");

Unless you are really obsessive about speed of the script, always use 
CGI.pm instead of cgi-lib.pl Better compatiblity, easier use, and the 
like make it worth using.

> 
> &ReadParse(*input);
> 
> print &PrintHeader;
> $file="items";
> 
> $database=tie(%db, 'DB_File', $file, O_RDWR|O_CREAT, 0770) || die "can't";

If you plan to do many CGI scripts, you should probably get used to using 
a template script, so that your code is cleaner, and you can edit your 
displays without going to code.

> print <<"HTML";
> <html>
> <head>
> <title></title>
> </head>
> 
> <body bgcolor="#FFFFFF">
> <img src="../auction/images/logo_small.jpg" width="211" height="90">
> <br>
> HTML
> 
>  while (($key,$value)= each(%db))
>  {
>    @part = split(/:/,$value);
>    if ($key =~ /$input{'number'}/i)
>    {
>      delete $db{$key};
> 	 $part[8]++;
> 
> 	 print "Test";
>    }
> 
>  }
> 
> $db{$key}=join(":",$part[0],$part[1],$part[2],$part[3],$part[4],$part[5],$part[6
> ],$part[7],$part[8]);

$db{$key} = join ':', @part;

is a much easier way to do it. (Unless the list is longer then you wanted 
joined.)

Let me know if you have other questions.

-Sam


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

Date: 20 Apr 1999 14:26:21 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: for (my $i;;) doesn't work like I think it should
Message-Id: <7fi2qd$6aa$1@pegasus.csx.cam.ac.uk>

In article <7fgfr0$ael$1@nnrp1.dejanews.com>,  <raylutz@adaptra.com> wrote:
>Consider the following code segment:
>{
>    # pass one
>    my $i; my $j = 0;
>    for ($i = 0; $i < 8; $i++) {
>        print "pass 1: \$i=$i\n";
>        $j++;
>        }
>
>    print "Pass 1 End: \$j = $j;\n\n";
>
>    # pass two
>    my $j = 0;
>    for (my $i = 0; $i < 8; $i++) {
>        print "pass 2: \$i=$i\n";
>        $j++;
>        }
>
>    print "Pass 2 End: \$j = $j;\n\n";
>}
>The only difference between pass one and two is the 'my' in the for().
>According to the perl docs I've read, these SHOULD do the same thing.

Only in versions 5.004 and later of Perl.

And I also note you aren't using -w  -  that code gives a warning
(which in the example is harmless).


Mike Guy


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

Date: Tue, 20 Apr 1999 10:20:07 -0400
From: charles <charles@twcny.rr.com>
Subject: how old is perl 5
Message-Id: <371C8D17.BC5541BA@twcny.rr.com>

I saw a job posting asking for a person with 3+ years Perl 5.x
experience.  Has Perl 5.x been around that long?



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

Date: Tue, 20 Apr 1999 16:52:56 +0200
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: how old is perl 5
Message-Id: <371C94C8.2190737E@datenrevision.de>

charles wrote:
> 
> I saw a job posting asking for a person with 3+ years Perl 5.x
> experience.  Has Perl 5.x been around that long?

According to perlhist.pod, 5.000alpha1 has been around since 1993-Jul-31
(five months after 4.036), and 5.000 "for real" on 1994-Oct-18, 15
months later. So it is possible to have 4.5 to 6 years of Perl 5.x
experience, depending on which starting point you take.

(Note: I don't know whether any of the alpha's, 5.000[ab]* etc. were
ever released, so the 5.000 is probably the better bet: 4.5 years ago
last Sunday.)

Cheers,
Philip


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

Date: 20 Apr 1999 08:29:24 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to join two hashes?
Message-Id: <371c8f44@cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    lr@hpl.hp.com (Larry Rosler) writes:
:The hash-slice approach is efficient.  The values of the shared keys 
:from the second hash overwrite those of the original hash.
:
:  @hash1{keys %hash2} = values %hash2;

Not for huge hashes it isn't -- imagine a hash tied to a ten-million
element DBM file, for example.  But for most cases, this is fine.

--tom
-- 
 The steady state of disks is full.
	 --Ken Thompson


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

Date: Tue, 20 Apr 1999 10:29:34 -0400
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: How to join two hashes?
Message-Id: <joe.mcmahon-2004991029350001@prtims.stx.com>

In article <371C5AB4.84699EC9@gredos.cnb.uam.es>, Federico Abascal
<fabascal@gredos.cnb.uam.es> wrote:

>Hello,
>does anybody knows how to join two hashes, if possible? (The two hashes
>have some keys similar)
>Thanks,
>Federico

If you mean merge them - i.e., you have %a and %b, and you want to put them
in %c without worrying about whether there are duplicate keys, try

   %c = (%a, %b);

Otherwise, if you want to retain the duplicates, try Tie::AppendHash.

 --- Joe M.


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

Date: 20 Apr 1999 14:37:53 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Interpolating Variables for 'use'
Message-Id: <7fi3g1$70l$1@pegasus.csx.cam.ac.uk>

In article <7fggpp$mjc$1@fcnews.fc.hp.com>, Andrew Allen <ada@fc.hp.com> wrote:
>
>(The same nagging voice was telling me that 'use MODULE', despite the
>insistence of perlfunc, isn't _really_ identical to the require/import
>sequence).

Yes it is.    The point is that the syntax of use is limited to a
literal module name, whereas require allows a literal module name or
an expression.    So if you write

       use $module;

you'll get a syntax error (and an immediate abort of compilation).
The expansion of the module name (adding .pm, changing :: to / etc)
occurs for both use and require, but only in literal case.

So it looks like you're stuck with eval "use $module" in the general case.
:-(


Mike Guy


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

Date: Tue, 20 Apr 1999 04:21:23 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl cookbook ...
Message-Id: <3edhf7.5f3.ln@magna.metronet.com>

Ron Reidy (rereidy@uswest.net) wrote:

: This is a multi-part message in MIME format.
                                  ^^^^^^^^^^^

   Please don't do that.

   Usenet is a plain text medium.

   Please configure your "newsreader" properly.


: open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq")
:     or die "Can't fork for sendmaile: $!\n";


: We could not force the die statement to fail.  Is it me/him, or is there
: something missing here.


   Perl FAQ, part 8:

      "Why doesn't open() return an error when a pipe open fails?"


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


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

Date: Tue, 20 Apr 1999 13:48:48 GMT
From: jayguerette@my-dejanews.com
Subject: Perl Minimum Install
Message-Id: <7fi0k0$js9$1@nnrp1.dejanews.com>

I would like to use Perl as the scripting engine for my Windows NT domain
logon script. I would rather not install Perl on the 150+ machines in the
domain, and would like to avoid having 1meg of .exe & .dll's transferred
across the network every time someone logs on. I figured I could copy the
required EXE & DLL's to each local machine as part of the script, and only
take the hit once. So here's the question, what are the absolute minimum
required files for ActivePerl on Windows NT?

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


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

Date: Tue, 20 Apr 1999 06:58:10 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl notation question?
Message-Id: <MPG.118627c9efb3fd389898ed@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <371C5E24.2FF1C2FD@zap.a2000.nl> on Tue, 20 Apr 1999 12:59:48 
+0200, Joel Wijngaarde <vasquez@zap.a2000.nl> says...
> Can somebody tell me in a clear way what the difference is between:
> 
> 	open(IN, "$ARGV[$i]/$input") or die("Can't open file: $!\n");
> and
> 	open IN, "$ARGV[$i]/$input" or die "Can't open file: $!\n";
> 
> I mean what the difference is between the expression with '(' and
> without the '('.

There is no difference whatever.

> Why do they both exist?

Sometimes parentheses are needed to change the order of evaluation.  
This is not one of those cases.

If one chose instead of 'or' to use the operator '||' (not my choice, 
but ...), then the first pair of parentheses would be required, but the 
second would still be optional.

TIMTOWTDI.

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


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

Date: Tue, 20 Apr 1999 16:46:19 +0200
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Perl notation question?
Message-Id: <371C933B.DA5CAC5F@datenrevision.de>

Larry Rosler wrote:
> 
> TIMTOWTDI.

Even with this abbreviation.

I've seen both TMTOWTDI and TIMTOWTDI.

Which of these, if any, is 'official'? Or are both 'officially correct'?
(I believe the Camel uses TMTOWTDI, but don't have it handy to check;
perlfaq1 and 7 both contain TMTOWTDI once each.)

Cheers,
Philip


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

Date: Tue, 20 Apr 1999 16:13:57 +0200
From: Federico Abascal <fabascal@gredos.cnb.uam.es>
Subject: Removing elements of an array...
Message-Id: <371C8BA4.310C6257@gredos.cnb.uam.es>

How can I remove an element of an array? If I do this way:
        undef $array[5];
does the element $array[6] go to position 5?
What's the better way to remove an element in a way that the next
elements go to the previous position?

Thanks a lot,
Federico




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

Date: Tue, 20 Apr 1999 14:31:37 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Removing elements of an array...
Message-Id: <dd0T2.132$Li1.38606@news1.rdc1.on.wave.home.com>

In article <371C8BA4.310C6257@gredos.cnb.uam.es>,
 Federico Abascal <fabascal@gredos.cnb.uam.es> wrote:
! How can I remove an element of an array? If I do this way:
!         undef $array[5];
! does the element $array[6] go to position 5?

can you not write a test script to find this out
for yourself?

! What's the better way to remove an element in a way that the next
! elements go to the previous position?

perldoc -f splice

regards
andrew



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

Date: Tue, 20 Apr 1999 10:46:24 -0400
From: charles <charles@twcny.rr.com>
Subject: Re: Removing elements of an array...
Message-Id: <371C9340.3456BD8E@twcny.rr.com>

Hi Federico,

One way you could do it is with "splice", a Perl built-in.

In the example you give below you would do this:

splice(@array,5,1);

That will reduce your array by one element, the one at offset 5.

Charles

Federico Abascal wrote:

> How can I remove an element of an array? If I do this way:
>         undef $array[5];
> does the element $array[6] go to position 5?
> What's the better way to remove an element in a way that the next
> elements go to the previous position?
>
> Thanks a lot,
> Federico



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

Date: Tue, 20 Apr 1999 07:45:42 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Removing elements of an array...
Message-Id: <MPG.118632e5c07e07559898ee@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <371C8BA4.310C6257@gredos.cnb.uam.es> on Tue, 20 Apr 1999 
16:13:57 +0200, Federico Abascal <fabascal@gredos.cnb.uam.es> says...
> How can I remove an element of an array? If I do this way:
>         undef $array[5];
> does the element $array[6] go to position 5?

No, it doesn't.

> What's the better way to remove an element in a way that the next
> elements go to the previous position?

perldoc -f splice

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


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

Date: Tue, 20 Apr 1999 16:56:23 +0200
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Removing elements of an array...
Message-Id: <371C9597.EF8D519@datenrevision.de>

Federico Abascal wrote:
> 
> How can I remove an element of an array? If I do this way:
>         undef $array[5];
> does the element $array[6] go to position 5?

No, it just becomes undef. Did you try it out?

> What's the better way to remove an element in a way that the next
> elements go to the previous position?

perldoc -f splice (or, as a special case, shift)

Cheers,
Philip


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

Date: Tue, 20 Apr 1999 04:36:00 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Sorting Hashes of Arrays....
Message-Id: <g9ehf7.5f3.ln@magna.metronet.com>

Anthony Baratta (Anthony@Baratta.com) wrote:

: Here is the data....ID, Name, Address, City (being pulled from an mSQL
: Database)

: What I am looking for is the best way to store this info in an Array,
: Hash, Hash of Arrays - whatever allows me to pull the data out ordered
: by City and Name.


   _Any_ of those allow you to pull data out ordered by City and Name,
   since you can apply a sort() to any of them.

   What matters more in deciding what data structure to use is
   how the data is to be used.

   The usual weightiest factor is _looking up_ stuff rather than
   displaying it once found.

   This assumes that you plan to be looking things up often.

   So then we need to know what you plan to key on when doing
   lookups.


   What do you plan to key on when doing lookups?  :-)

   Based on the ID?

   The Name?

   Something else?

   Sometimes ID and othertimes Name?

   ...


: Would I be better off using the 'order by' option with the SQL select
: statement when I retrieve the data and then iterating through the list
: with a for loop? 


   A linear search (iterating through the entire list) is often
   the worst possible way to search for something.

   A linear search does not require any ordering of the data 
   anyway so "order by" isn't going to get you anywhere if you
   are just going to walk the whole list anyway.


: Or is there some automagical sort option with a Hash of
: Arrays that allow me to sort by the City and Name fields?


   There is a sort option that allows you to sort by the City and 
   Name fields.

   It is, however, not automagically created for you.

   You need to learn how to do sorting in Perl, start with
   the Perl FAQ, part 4:

      "How do I sort an array by (anything)?"

      "How do I sort a hash (optionally by value instead of key)?"

      "How can I always keep my hash sorted?"



   And there are some sorting examples in the description of sort()
   in 'perlfunc.pod' too.


: Any thoughts would be appreciated.


   You have not given us enough information to suggest an
   optimal data structure.


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


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

Date: Tue, 20 Apr 1999 10:38:07 -0400
From: "Joe Carpio" <carpioj@warwick.net>
Subject: system() call on 5.005_03
Message-Id: <7fi3dn$7u61@news.warwick.net>

We developed a program (on  WinNT platform) with system() calls using
5.004_04 which works fine.  However, when we tried to run it on 5.005_03, we
get a different return code from what we got when using 5.004.  Any ideas /
suggestions ?.  The PERL5SHELL is not set to anything right now.  TIA.




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

Date: 20 Apr 1999 08:01:26 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Tool Reuse Considered Beneficial (was: New FAQ: How can I read in an entire file all at once?)
Message-Id: <371c88b6@cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, gerg@shell1.ncal.verio.com (Greg Andrews) writes:
:The reason is /usr/bin/cat lives on a mounted partition, and one or two
:of the startup scripts need to read the contents of files before /usr
:is mounted.

Mistake number 1.

:Particularly if /usr is mounted from an NFS
:server - the network interfaces must be brought up first.

Mistake number 2.

And being linked to shared libraries on a different partition 
than it itself resides is mistake number 3.

--tom
-- 
    Hey, I had to let awk be better at *something*...  :-)
            --Larry Wall in <1991Nov7.200504.25280@netlabs.com>1


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

Date: Tue, 20 Apr 1999 14:03:49 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Top 10 newbie errors?
Message-Id: <371d8939.1727486824@news.ford.com>

[poster cc'd in e-mail]

On Tue, 20 Apr 1999 09:49:53 GMT, ran@netgate.net    (Ran) wrote:
>In <371bf46a.3254335@news.roalok1.mi.home.com>, clintp@geeksalad.org (Clinton Pierce) writes:
>
>>But using a B&D language can spoil the wonder in simply pasting a
>>little bit of code from here-and-there and making the computer do what
>>you want.  
>
>It can also spoil the "wonder" of trying to figure out why:
>
>   for ($i = 0; $i < $lim; $l++)
>
>"just puts the computer in a loop",  when a "use strict" would've caused
>a "Hey,  what's this '$l' thingie?" before the problem arose.

"use strict" would have done no such thing.  That's inaccurate.  Stop
saying that.

That's my point.  Compiler warnings ("-w") would have told the user:

	Name "main::l" used only once: possible typo at...

"use strict" would have complained about:

	Global symbol "$lim" requires explicit package name...
	Global symbol "$i" requires explicit package name...
	Global symbol "$l" requires explicit package name...

For the new programmer, the first error is far-and-away more helpful than
the other three.  BTW, the newbie "cure" for the error /Global symbol
"([^"]+)+" requires explicit package/ tends to be /my\($1\);/ -- they do
it all the time with no understanding of why they do it.
-- 
Clinton A. Pierce       "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org        Miracles."  -- Miracle Max, The Princess Bride
http://www.geeksalad.org


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

Date: Tue, 20 Apr 1999 10:46:08 -0400
From: dwilgaREMOVE@mtholyoke.edu (Dan Wilga)
Subject: Re: Unix files in MacPerl
Message-Id: <dwilgaREMOVE-2004991046080001@wilga.mtholyoke.edu>

> Major overkill...if Jason will simply set his ftp client to transfer his
> perl code in ASCII mode and not binary, this "problem" will go away.

Another alternative would be to install netatalk on the Unix machine,
since it will do the EOL conversion automatically on a volume that is
mounted through Appleshare or Appleshare IP.

Dan Wilga          dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply  **


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

Date: Tue, 20 Apr 1999 04:15:48 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Wanna post, need programmer help
Message-Id: <k3dhf7.5f3.ln@magna.metronet.com>

Wyzelli (wyzelli@yahoo.com) wrote:

: You got too much time on your hands Abigail!!


   You've got too much quoted text in your followup Wyzelli!

   (over 50 quoted lines and *1* new line!!)

   Please don't waste our shared bandwidth with bytes that
   are unneeded.


   You also have the answer (followup) before the question.

   Question then answer is the normal flow, this isn't Jeopardy.

   Please add your followup comments _after_ the quoted text
   that you want to comment about.



: lol


   Me to, BTW  :-)


: Wyzelli
: Abigail wrote in message <7fh2dg$j97$1@client2.news.psi.net>...
: >jeanb (jean_barry@my-dejanews.com) wrote on MMLVII September MCMXCIII in
: ><URL:news:7fg92b$4eo$1@nnrp1.dejanews.com>:
: >\\
: >\\ Can someone tell me what's going on.
: >
: >Well, Tammy-Lee and Johnny got married; forced by their parents because
: >Tammy-Lee is pregnant. Fred, Johnny's little brother ran away from home,
: >and has been missing for nine days now, missing the wedding. Elmer,
: >Tammy-Lee's nephew acted as a stand-in ring bearer. The wedding features
: >17 female relatives and friends, and 2 males ones with tears.



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


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 5428
**************************************

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