[11461] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5061 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 4 22:07:22 1999

Date: Thu, 4 Mar 99 19:00:18 -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           Thu, 4 Mar 1999     Volume: 8 Number: 5061

Today's topics:
    Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Pos (Tad McClellan)
    Re: <STDIN> Question (Larry Rosler)
    Re: <STDIN> Question (Ilya Zakharevich)
        DBI::DB2 problem connecting <matthew@tpg.au.com>
        FAQ 1.2: Who supports Perl?  Who develops it?  Why is i <perlfaq-suggestions@perl.com>
    Re: HELP!! How to obtain html info by LWP ??? <mwatkins@promotion4free.com>
    Re: How to run Perl program as NT service? <herys@ctsnet.com>
        I'm looking for a good code editor for PERL for Win NT <alejandro.eluchans@umb.edu>
    Re: Load an array from a file. (Tad McClellan)
    Re: mod_perl leak help (yes, using strict, -w :) <marks@webleicester.co.uk>
    Re: Perl comment RABM@prodigy.net
        Perl Memory Bug ? <marks@webleicester.co.uk>
    Re: procmail-ish mail handler in perl? (Abigail)
    Re: Re: Re: can I make this code better? (Alan Young)
        Script Search <rtg@northeast.net>
        searching filenames <seugenio@man.amis.com>
    Re: Sorting trouble. Almost solved. Final touch needed. (Chris Sherman)
    Re: URGENT! Where Do You Hide The CGI Cards From The Sp (Martien Verbruggen)
    Re: Using system command with ftp <davidk@netscape.com>
        Windows NT registry access examples? (Stan Brown)
    Re: y2k and 4-digit dates (was Re: foreach and while) (Abigail)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 4 Mar 1999 14:41:38 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Posted Twice Weekly ***
Message-Id: <ilnmb7.ejm.ln@magna.metronet.com>

Philip Newton (Philip.Newton@datenrevision.de) wrote:
: Ilya Zakharevich wrote:
: > 
: > [A complimentary Cc of this posting was sent to Philip Newton
: > <Philip.Newton@datenrevision.de>],
: > who wrote in article <36DD5534.3CCBA728@datenrevision.de>:
: > > I'm waiting for the entry that will answer "What is her last name?".
: > 
: > Why "her"?

: Because "Abigail" is, to my knowledge, only a female given name. I
: assumed it is Abigail's own given name, and hence, that Abigail is
: female.


   Unless Abigail is really a guy and is just pulling your chain...


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


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

Date: Thu, 4 Mar 1999 17:12:23 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: <STDIN> Question
Message-Id: <MPG.1148cf55cdfe07199896e4@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <39pv6ohk14.fsf@ibnets.com> on 04 Mar 1999 19:12:07 -0500, 
Uri Guttman <uri@ibnets.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
>   LR> In article <_vDD2.147$I51.15386@news.shore.net> on Thu, 04 Mar 1999 
>   LR> 22:08:58 GMT, Scratchie <upsetter@ziplink.net> says...
>   LR> ...
>   >> I have a program that, in a certain situation, reads a file from STDIN (in
>   >> other words, it's called as 'myscript < myfile').
>   >> 
>   >> Is there a way, once STDIN has been read and stored in an array, to
>   >> "reset" STDIN so I can interact with the user? (a la 'chomp ($response =
>   >> <STDIN>);'). 
> 
>   LR> I'm having trouble on Unix, though, because there are many pseudo-files 
>   LR> named "/dev/tty...".  This C program:
> 
> on (most) unix the device /dev/tty should always be the terminal you are
> running on. 

Right.  I should have tried that.
 
>   LR> Any other thoughts??? 
> 
> but perl is smarter than you are.

I should hope so, with all the brainpower behind it!

>                                    this seems to work just fine:
> 
> perl -e '@a=<>; print @a; open( STDIN, q(-) ); $l=<>; print "[$l]\n"'

And it is even documnted explitily, in `perldoc -f open`:

Opening '-' opens STDIN and opening '>-' opens STDOUT.

So the platform-independent name of the terminal in Perl is '-'.  
Problem solved.

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


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

Date: 5 Mar 1999 02:23:58 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: <STDIN> Question
Message-Id: <7bnf7u$grj$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Sean McAfee
<mcafee@waits.facilities.med.umich.edu>],
who wrote in article <ftFD2.10070$Ge3.39450846@news.itd.umich.edu>:
> I don't think you can "reset" STDIN, but if you're on a Unix system you can
> reopen it using /dev/tty:
> 
> while (<STDIN>) { print }
> open(STDIN, "< /dev/tty");
> print "Did you like what you saw? ";
> chomp($reply = <STDIN>);

And using Term::ReadLine will get you the same functionality without
any system-specific assumptions.

Ilya


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

Date: Fri, 5 Mar 1999 12:17:54 +1100
From: "Matthew" <matthew@tpg.au.com>
Subject: DBI::DB2 problem connecting
Message-Id: <mgGD2.156$Fh.1469@nswpull.telstra.net>

I am executing a perl script from a HTMLfrom. The perl script as 777
permisions.

The function of the script is to take a single line of text from the form
and pass it to a DB2 database then display the results in a table.

I am setting what I think to be the correct enviroment varialbes and am
resonable certain the permissions are not a problem.

When the script runs I get the following error message.

           [IBM][CLI Driver] SQL1032N No start database manager command was
issued. SQLSTATE=57019

and here is the complete script

#!/usr/bin/perl
use DBI;
use DBD::DB2::Constants;
use DBD::DB2;
use CGI;

# send errors to browser
use CGI::Carp qw(fatalsToBrowser);

$ENV{DB2_HOME}="/usr/IBMdb2/V5.0/";
$ENV{DB2DIR} = "/usr/IBMdb2/V5.0";
$ENV{DB2INSTANCE}="db2inst1";
$ENV{INSTHOME}="/home/db2inst1";
$ENV{PATH}="$ENV{path}:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:
            /home/db2inst1/sqllib/misc";

$dbName     = "DBI:DB2:sample";
$dbUserName = "db2inst1";
$dbPassword = "db2inst1";

$dataIn = new CGI;
$dataIn -> header();
$requestType = $dataIn -> param('requestType');
$sql = $dataIn -> param('sql');

if ($sql eq "")
  {
  print qq!
  <HTML>
  <HEAD>
    <TITLE> Enter SQL </TITLE>
  </HEAD>
  <BODY BGCOLOR = "#FFFFFF" TEXT = "#000000">
    <FORM METHOD ="POST" ACTION = "show.pl">
      <TABLE BORDER = "1">
      <TR> <TH> Enter SQL Query</TH>
        <TD><INPUT TYPE = "TEXT" SIZE = "40" NAME = "sql"></TD>
        <TD>
        <INPUT TYPE = "SUBMIT" NAME = "requestType" VALUE = "Submit SQL">
        </TD>
      </TR>
      </TABLE>
    </BODY>
  </HTML>!;
  exit;
else
  {
  $dbh = DBI -> connect($dbName,$dbUserName,$dbPassword)
                       || die "No Connection Made: $DBI::errstr";

  $dataObject = $dbh -> prepare($sql);
  $dataObject -> execute();
  @dbRows = $dataObject -> fetchall_arrayref();
  if ($sql =~ /^SELECT/i)
    {
    print qq!
    <HTML>
    <HEAD>
      <TITLE>SQL Statement Results</TITLE>
    </HEAD>
    <BODY BGCOLOR = "#FFFFFF" TEXT = "#000000">
      <CENTER>
      <TABLE BORDER = "1"> !;
        foreach $rowReference(@dbRows)
          {
          foreach $columnReference(@columnReference)
            {
            foreach $column(@$columnReference)
              {print qq! <TD> $column </TD> \n!;}
            print qq!</TR>!;
            }
          }
        print qq!
      </TABLE>
      </CENTER>
      </BODY>
    </HTML>!;
    exit;
    }
  else
    {
    print qq~Your SQL query has been processed, please hit the
             back button and submit a SELECT to see the changes!~;
    }
}


Any help would be great

Thanks

Matthew.
















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

Date: 4 Mar 1999 18:09:44 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 1.2: Who supports Perl?  Who develops it?  Why is it free?  
Message-Id: <36df2ed8@csnews>

(This excerpt from perlfaq1 - General Questions About Perl 
    ($Revision: 1.21 $, $Date: 1999/01/26 09:55:05 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq1.html
if your negligent system adminstrator has been remiss in his duties.)

  Who supports Perl?  Who develops it?  Why is it free?

    The original culture of the pre-populist Internet and the deeply-
    held beliefs of Perl's author, Larry Wall, gave rise to the free
    and open distribution policy of perl. Perl is supported by its
    users. The core, the standard Perl library, the optional modules,
    and the documentation you're reading now were all written by
    volunteers. See the personal note at the end of the README file
    in the perl source distribution for more details. See the
    perlhist manpage (new as of 5.005) for Perl's milestone releases.

    In particular, the core development team (known as the Perl
    Porters) are a rag-tag band of highly altruistic individuals
    committed to producing better software for free than you could
    hope to purchase for money. You may snoop on pending developments
    via nntp://news.perl.com/perl.porters-gw/ and the Deja News
    archive at http://www.dejanews.com/ using the perl.porters-gw
    newsgroup, or you can subscribe to the mailing list by sending
    perl5-porters-request@perl.org a subscription request.

    While the GNU project includes Perl in its distributions, there's
    no such thing as "GNU Perl". Perl is not produced nor maintained
    by the Free Software Foundation. Perl's licensing terms are also
    more open than GNU software's tend to be.

    You can get commercial support of Perl if you wish, although for
    most users the informal support will more than suffice. See the
    answer to "Where can I buy a commercial version of perl?" for
    more information.

-- 
I'm a programmer: I don't buy software, I write it.
    --Tom Christiansen


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

Date: Wed, 3 Mar 1999 13:59:17 -0000
From: "Mike Watkins" <mwatkins@promotion4free.com>
Subject: Re: HELP!! How to obtain html info by LWP ???
Message-Id: <uFeWI5XZ#GA.53@nih2naae.prod2.compuserve.com>

Hi there,

Not sure if this is what your looking, but:

 my $Request = HTTP::Request->new (GET => $Row);
 my $Response = $ua->request ($Request);
 my $HTML = $Response->content();

my $Header = $Response->headers_as_string;

That should give you the headers of the HTML page, like Content-Length,
ect..

Hope that helps,
Mike


lufan@hotmail.com wrote in message <36DC77BB.1ED7@hotmail.com>...
>Hi,
>
>I need some code samples showing how the read the
>head info of target html or other files (size, last update date,
>etc). I use LWP, but fail to get the returned headers from
>response.
>
>Do I need to perform a request first ?
>thanks in advance ;)
>
>
>lufan




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

Date: Thu, 4 Mar 1999 21:45:48 -0500
From: "Henry Schlarb" <herys@ctsnet.com>
Subject: Re: How to run Perl program as NT service?
Message-Id: <7bngk2$218$1@demon.uunet.ca>

It would be better if you either

    -installed the perl.exe as a service and specify the script as a
parameter. This is detailed in the servany documentation. I don't think
batch files run well as a service.

    -put the script in your startup directory

for more info, respond directly to me. I work a couple of blocks from your
address.

Bob Fillmore wrote in message <36DDBB08.6F21193E@nrn1.nrcan.gc.ca>...
>I would like to run a Perl program as an NT service so that it's started
>on each reboot.
 ........
>Any help is much appreciated.
>
>--
>Bob Fillmore, Technical Services Division       email:
>fillmore@NRCan.gc.ca
>  Information Management Branch,
>  Natural Resources Canada,                     Voice: (613) 992-2832
>  580 Booth St., Ottawa, Ont., Canada  K1A 0E4  FAX:   (613) 996-2953
>
>




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

Date: Wed, 03 Mar 1999 09:23:20 -0600
From: Alejandro Eluchans <alejandro.eluchans@umb.edu>
Subject: I'm looking for a good code editor for PERL for Win NT
Message-Id: <36DD53E8.B34AA9C7@umb.edu>

I need a good text editor for PERL code that among other things, it must
indent nested code automatically.

Alejandro



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

Date: Thu, 4 Mar 1999 14:40:08 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Load an array from a file.
Message-Id: <oinmb7.ejm.ln@magna.metronet.com>

Robert B. Ganz (rganz@rushu.rush.edu) wrote:

: I was wonder if Perl is capable of loading an array from a file?


      @lines = <INPUTFILENAME>;
                ^^^^^^^^^^^^^


   [ note that the "thingy" there is a "filehandle" which is
     _not_ the same as a filename. You are using a very
     misleadingly named filehandle there...
   ]


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


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

Date: Thu, 04 Mar 1999 14:17:24 +0000
From: Mark Simonetti <marks@webleicester.co.uk>
Subject: Re: mod_perl leak help (yes, using strict, -w :)
Message-Id: <36DE95F3.B4489FBD@webleicester.co.uk>

Hmm, that doesn't seem right.. When memory is free'd within a process, it
should be returned to the system.
Compile and run this in Linux, run "top" and watch how much memory the process
is using as you allocate, and then free the memory  : -

#include <stdlib.h>

int main()
{
  int *ptr;
  long i = 8*1024*1024;
  printf("Hit a key to fill memory\n");
  getchar();
  ptr = malloc(sizeof(char)*i);

  memset(ptr, 'a', i);

  printf("Hit a key to free memory\n");
  getchar();
  free(ptr);

  printf("Hit a key to end\n");
  getchar();
}

Mark.
--

Jim wrote:

> >>    [1] Could the leak be in my script even though I get no warnings?
> >
> >Yes. Easily.
>
> Thanks . . . As is so often the case as a newbie to Linux/Perl, my
> understanding of the memory management was fundamentally flawed.  I did not
> realize that processes will generally not return memory to the OS (at
> least, that's what I read elsewhere).  So these long-lived httpd processes
> might hover at one size as long as my Perl/DBI queries pull in small
> amounts of data, but as soon as they hit a larger record they'll shoot up
> in memory usage to accomodate it, and then won't release it.  My
> understanding is also that that the process can reuse that memory, but the
> OS won't reclaim it until the process dies.  I had assumed that the
> process-growth was indicative of a leak, but apparently that's not true (I
> hope).
>
> Anyway, thanks.
>
> Jim

--
o----------------------------------------------o
| Mark Simonetti     | Innovation Centre       |
| Software Engineer  | De Montfort University  |
| Musician           | Leicester.              |
|----------------------------------------------|
| Email : se96ms@dmu.ac.uk                     |
| WWW   : http://www.cms.dmu.ac.uk/~se96ms/    |
o----------------------------------------------o





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

Date: 04 Mar 1999 21:03:17 -0500
From: RABM@prodigy.net
To: strads@tmisnet.com (George Crissman)
Subject: Re: Perl comment
Message-Id: <upv6o3d7e.fsf@prodigy.net>

>>>>> "George" == George Crissman <strads@tmisnet.com> writes:

    George> On Mon, 01 Mar 1999 12:07:06 +0100, Philip Newton  wrote:
    >> KC wrote:
    >>> dubing wrote:
    >>> > Is there any easy way to comment out a block of Perl code (like how
    >>> > /*....*/
    >>> > is used in C) instead of putting '#' at the beginning of each line
    >>> > line by line?
    >>> Nope. The pound sign is it.
    >> ...and the advantage over C comments is that Perl comments can be
    >> "nested" ... if a line begins with '#' and you add another one, it's
    >> still a comment, whereas /* /* ... */ */ will usually cause problems :)

    George> ...unless you set the "allow nested comments" flag in the compiler ...

Use pod.  perldoc perlpod
=head1 comment

    foreach my $f ( @ARGV ) {
	print "you said $f!!\n";
    }

=cut

    George> -- George Crissman
    George> -- strads@tmisnet.com



-- vjm


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

Date: Thu, 04 Mar 1999 13:23:24 +0000
From: Mark Simonetti <marks@webleicester.co.uk>
Subject: Perl Memory Bug ?
Message-Id: <36DE894B.2A1E9E8D@webleicester.co.uk>

Hi,

I've noticed that when doing pattern matching within a program, which
iterates 1000's of times, and the pattern match uses a "$", to specify
it must be the end of the pattern.. that the memory usage just keeps
creeping up, until eventually you get an out of memory message.. anyone
else seen this ?  Its fine if I take out the "$", though then I have to
completely rethink the pattern match..  It only seems to happen with
that "$" sign..

Mark
--
o----------------------------------------------o
| Mark Simonetti     | Innovation Centre       |
| Software Engineer  | De Montfort University  |
| Musician           | Leicester.              |
|----------------------------------------------|
| Email : se96ms@dmu.ac.uk                     |
| WWW   : http://www.cms.dmu.ac.uk/~se96ms/    |
o----------------------------------------------o




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

Date: 5 Mar 1999 01:11:35 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: procmail-ish mail handler in perl?
Message-Id: <7bnb07$o2p$1@client2.news.psi.net>

Elaine Ashton (elaine@cts.wustl.edu) wrote on MMXI September MCMXCIII in
<URL:news:36DED890.2E13A181@cts.wustl.edu>:
 .. Lindbergh Loomis wrote: 
 .. > Has anyone here taken the plunge and authored their own e-mail handler
 .. > application, in lieu of procmail or 3rd-party spamgards? Any success or
 .. > failure stories?
 .. 
 .. tom has some cool stuff here;
 .. http://www.cpan.org/modules/by-authors/Tom_Christiansen/scripts/ qmail
 .. is written in Perl as is majordomo and a bunch of other doodads...so,
 .. I'm sure that it has been done. 


qmail isn't written in Perl. (Luckely. I wouldn't want 20 perl spawning
simultaniously).

Chip wrote "deliver" however, and that's, AFAIK, written in Perl.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Fri, 05 Mar 1999 01:07:56 GMT
From: alany@2021.com (Alan Young)
Subject: Re: Re: Re: can I make this code better?
Message-Id: <36e028a9.5015494@news.supernews.com>

[cc'd ]

On Thu, 4 Mar 1999 11:52:10 -0800, lr@hpl.hp.com (Larry Rosler) wrote:

>> Experimentation is fun! If I add sort in front of map I'll then get a
>> sorted output (since item codes are alpha-numeric I don't need to
>> worry about anything else)!
>
>You might worry about the nonexistent items and where they sort.  :-)

yeahbut ... If I add a space before Item (' Item ...') then
nonexistent Items will be placed first on the list, which is what I
want.

>> The more I know perl the more I like it!  Wheeee!
>
>ITYM Yee-haw!

:)

I have another question but I'm posting that separately.  I don't want
you to think I'm taking advantage or anything! :)

-- 
Alan Young                                            Technical Support
http://members.xoom.com/AlanYoung                 2021.Interactive, LLC
If your happy and you know it, clunk your chains!   http://www.2021.com

892 I wish you humans would leave me alone.



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

Date: Thu, 04 Mar 1999 21:36:03 -0500
From: Mike Rura <rtg@northeast.net>
Subject: Script Search
Message-Id: <36DF430E.CC449562@northeast.net>

A simple script to search my website by standard META-TAG KEYWORDS or
search a simple database.

Email me in .tar or .zip

Mike



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

Date: 5 Mar 1999 00:58:25 GMT
From: "Sheila  Eugenio" <seugenio@man.amis.com>
Subject: searching filenames
Message-Id: <01be66a3$a837bc80$2bbe10ac@amipnet>

I am planning to create a script that will search a directory of filenames
through a 4-field form. The filenames are named this way: 
	FT19990405.txt where FT,QC,RM,RL=area
			      	           1999=year
			                           04=week
			                           05=report#

How can I make a comparison in such a way that when a user fails to fill up
one or more fields, it will look for all possible combinations? I have the
ff codes: 

$dir = 'f:/engg/reports/';
$search = "${area}${year}${week}";
$url = "http://home/engg_rep/".$search.".txt";
opendir (ENGG, "$dir") or die "Can't open directory";
while (defined($file=readdir(ENGG))) {
		$new = substr($file, 0, 8);
		if ($search=~/$new/) {
		print "<a HREF=\"$file\">$new</a><br>\n";
		}
	}	

It did not work the way I expected it. I'm sure there's a better script.
Pls help. Thank you very much.	 



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

Date: Fri, 5 Mar 1999 01:07:34 GMT
From: sherman@unx.sas.com (Chris Sherman)
Subject: Re: Sorting trouble. Almost solved. Final touch needed.
Message-Id: <F83KGM.7Ex@unx.sas.com>

In <tGED2.14$5R.2106@dummy.bahnhof.se> "Par Svensson" <par@removethis.bahnhof.se> writes:

> Would somebody be able to tell me how to incorporate the
> "sortorder" comparison routine in the program Testprog.prl
> below, without altering the original code beyond recognition,
> I'd be very grateful.

How about something like this (without changing too much code):

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
#!/usr/local/bin/perl5 -w
use strict;

sub species($){
   return substr($_[0],0,8);
}
sub colour($){
   return substr($_[0],8,5);
}
sub weight($){
   return substr($_[0],13,3);
}
sub owner($){
   return substr($_[0],16,8);
}

sub sortorder {
   species($a) cmp species($b)
   or
   colour($a) cmp colour($b)
   or
   weight($a) <=> weight($b)
   or
   owner($a) cmp owner($b);
}

my @unsorteddata = <DATA>;
chomp(@unsorteddata);
my @sorteddata = sort sortorder @unsorteddata; 
my $result = join "\n", @sorteddata;
print $result;

__END__;
chicken black001eriksson
dog     red  030blom
chicken brown003svensson
chicken black010jansson
dog     green030blom
cat     black012svensson
chicken red  022blom
chicken black010eriksson
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


The following reflects a version closer to my style.  Also, this
should (I hope) be a lot faster than the previous version for
large amounts of data since each line is parsed only once before
sorting.

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
#!/usr/local/bin/perl5 -w
use strict;

sub sortorder {
   $a->{"species"} cmp $b->{"species"}
   or
   $a->{"colour"} cmp $b->{"colour"}
   or
   $a->{"weight"} <=> $b->{"weight"}
   or
   $a->{"owner"} cmp $b->{"owner"};
}

my @unsorteddata = ();
while (defined(my $line = <DATA>)) {
   chomp($line);
   my %data = ();
   ($data{"species"}, $data{"colour"}, $data{"weight"}, 
      $data{"owner"}) = unpack "a8a5a3a*", $line;
   push @unsorteddata, \%data;
}

my @sorteddata = sort sortorder @unsorteddata; 

foreach my $line (@sorteddata) {
   print $line->{"species"} . " -- " . $line->{"colour"} . " -- " .
         $line->{"weight"}  . " -- " . $line->{"owner"}  . "\n";
}

__END__;
chicken black001eriksson
dog     red  030blom
chicken brown003svensson
chicken black010jansson
dog     green030blom
cat     black012svensson
chicken red  022blom
chicken black010eriksson
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Hope this helps...
-- 
     ____/     /     /     __  /    _  _/    ____/
    /         /     /     /   /      /     /          Chris Sherman
   /         ___   /        _/      /          /
 _____/   __/   __/   __/ _\    _____/   _____/           sherman@unx.sas.com


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

Date: Fri, 05 Mar 1999 01:29:54 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: URGENT! Where Do You Hide The CGI Cards From The Spiders?
Message-Id: <msGD2.193$Fh.1541@nswpull.telstra.net>

In article <MPG.11487f9a7b82742c9896d9@nntp.hpl.hp.com>,
	lr@hpl.hp.com (Larry Rosler) writes:

> `man 3 crypt` states that 'The first two characters [of the encrypted 
> password] are the salt itself.'  It also says that the 'salt' characters 
> must be chosen from the set

The man pages for Solaris state that:

# man -s3C crypt

     The values returned by this function  may  not  be  portable
     among XSI-conformant systems.

which was also the idea I had about crypt. In fact, you can easily (if
you're paranoid) replace the crypt() call with your own
implementation, or even remove it from your system alltogether. It's
been done.

The bottom line is that crypt is not _guaranteed_ to be implemented in
the same way on all platforms, even if it is on many. Showing that it
is implemented the same way on at least two does not prove anything.
Showing that it isn't on at least two does.

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


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

Date: Thu, 04 Mar 1999 17:00:30 -0800
From: david keefer <davidk@netscape.com>
To: Pat Brown <brownpatrick@lucent.com>
Subject: Re: Using system command with ftp
Message-Id: <36DF2CAE.F384B2A6@netscape.com>

check out the ftp modules they work really well.

the ones I speak of are written by Graham Barr and they are on CPAN.



Pat Brown wrote:

> I have a web page that allows me to do a file upload, in my cgi-bin I have a
> perl script that accepts the file, what I need to do using ftp is send the
> file to another box.  I am trying the "system("ftp -s:kkkk")"  with no
> success. Help needed
>
> Thanks



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

Date: Fri, 5 Mar 1999 01:59:59 GMT
From: stanb@netcom.com (Stan Brown)
Subject: Windows NT registry access examples?
Message-Id: <stanbF83Mvz.K7F@netcom.com>

	I find myself in the unfortunate postion of trying to turn a NT box
	into a semi-usefuel machine.

	I need to make it configure autmaticly fro several defferent networks.
	I have a perl script that dose this nicely for FreeBSD. Seems that I
	will need to modify structures in the NT Registry, to change IP address
	etc, right?

	Can anyone point me to an example of how to do this in perl?

	Thanks.

-- 
Stan Brown     stanb@netcom.com                                    404-996-6955
Factory Automation Systems
Atlanta Ga.
-- 
Look, look, see Windows 95.  Buy, lemmings, buy!   
Pay no attention to that cliff ahead...            Henry Spencer
(c) 1998 Stan Brown.  Redistribution via the Microsoft Network is prohibited.


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

Date: 5 Mar 1999 01:21:02 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: y2k and 4-digit dates (was Re: foreach and while)
Message-Id: <7bnbhu$o2p$2@client2.news.psi.net>

Staffan Liljas (staffan@ngb.se) wrote on MMXI September MCMXCIII in
<URL:news:36DF0C2F.31034CAF@ngb.se>:
__ 
__ y2k is a problem if you think to narrowly and don't realise what you are
__ assuming about the context. Even for financial programs, there is
__ usually no problem with two digit dates, if the program was written to
__ handle the situation of the turn of a century, since financial
__ calculations rarely (if ever) need to run over a scope of more then 100
__ years.


Oh, they certainly do. We've had exactly this problem once. Dates are 
stored internally in various y2k safe methods, but that's not the only
problem. A entry screen for bond trades had fields for maturity dates.
Using 2 digit years. Then one customer wanted to trade 100 year bonds,
and suddenly 2 digit years don't suffice. And why was the entry screen
just 2 digits wide? For the very old reason: space. There's a limited
amount of space on a 80x24 screen. It took only a few lines of code to
deal with entering 4 digit years, but it took major headaches to fit
4 digits on the screen.



Abigail
-- 
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
         ${qq$\x5F$} = q 97265646f9 and s g..g;
         qq e\x63\x68\x72\x20\x30\x78$&eggee;
         {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'


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

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

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