[9311] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2906 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 18 20:07:23 1998

Date: Thu, 18 Jun 98 17:01:11 -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           Thu, 18 Jun 1998     Volume: 8 Number: 2906

Today's topics:
        500 Server Error (Drew)
    Re: 500 Server Error (Craig Berry)
        AXS 2.0 Date calacreek@my-dejanews.com
    Re: Beginner (Mike Stok)
    Re: Checking returns from system calls (Was: Please HEL (Michael J Gebis)
        Ctrl+C disable in perl program  <lxn@inet.net>
    Re: Faster Search <probavm@h8mail.laf.cat.com>
    Re: filehandles <aqumsieh@matrox.com>
        Get IP Address for Server Name <matt@monmouth.com>
    Re: Get IP Address for Server Name <bowlin@sirius.com>
    Re: How to sort alphanumeric string using "sort" functi <danboo@negia.net>
    Re: if (something eq "somethingfgjhf") (Bob Trieger)
    Re: if (something eq "somethingfgjhf") pehanna@my-dejanews.com
    Re: if (something eq "somethingfgjhf") (Darwin O.V. Alonso)
    Re: if (something eq "somethingfgjhf") (Patrick Timmins)
    Re: Little help on grabbing text <aqumsieh@matrox.com>
    Re: Making Life Easy - Templates, XSSI, Variables and s (Craig Berry)
    Re: Making Life Easy - Templates, XSSI, Variables and s <bowlin@sirius.com>
    Re: Making Life Easy - Templates, XSSI, Variables and s <rpsavage@ozemail.com.au>
    Re: Matching Question (Mike Stok)
    Re: Moving application from DOS to a GUI. <rpsavage@ozemail.com.au>
    Re: Net::Ftp module (Bob Trieger)
        ohsir.pl : suggestive perl poem (Rahul Dhesi)
        PERL & blobs (J. Belton McClure)
        perldoc vs. pod2man? (Leslie Mikesell)
    Re: Pod::Text -- Unix only? <*@qz.to>
        Running a VT100 perl script in Windows 95 (Phoenixl)
    Re: Socket program help (Don)
    Re: SORTING HASHES (THE NEWBIE WAY!!) <aqumsieh@matrox.com>
    Re: Sorting IP's - Help! <rootbeer@teleport.com>
    Re: Sorting IP's - Help! (Mike Stok)
    Re: Sorting IP's - Help! <mdc0788@fugue.ca.boeing.com>
    Re: Tied hash questions (Mike Stok)
        Update with PERL CGI PROBLEM (Hu Liang)
    Re: Using PERL to do a remote TELNET (Mike Stok)
    Re: Using STDIN as a symbolic reference? <escrubb@att.net>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 18 Jun 1998 22:11:42 GMT
From: drewv@sympatico.ca (Drew)
Subject: 500 Server Error
Message-Id: <358a9040.125662493@news1.on.sympatico.ca>

Hi there.  I am new at this and am trying to learn.  My system consists of the
following.  Win NT with IIS 3.0.  I installed perl into directory k:\perl which
contains the bin and lib directies.  In IIS I created virtual directories called
/perl mapped to k:\perl and /bin mapped to k:\perl\bin with read and execute
rights.

Whenever I go to use a .pl script for NT remotely, I am getting a 500 Server
Error - The Specified modeule could not be found.  If I run it by going
k:\perl\bin\script.pl it opens a dos window scrolls through some code and
closes.  

 .  Any idea what could be causing  this?

Thanks.

Andrew


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

Date: 18 Jun 1998 22:27:38 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: 500 Server Error
Message-Id: <6mc48q$b8c$3@marina.cinenet.net>

Drew (drewv@sympatico.ca) wrote:
[snip]
: Whenever I go to use a .pl script for NT remotely, I am getting a 500 Server
: Error - The Specified modeule could not be found.  If I run it by going
: k:\perl\bin\script.pl it opens a dos window scrolls through some code and
: closes.  

Asking this sort of question in comp.lang.perl.misc is a lot like calling
Chevrolet's customer service line to complain about a big pothole in your
home street.  Truly, that's how related server issues and Perl issues are.
You'll find much better help (and far fewer flames) in a newsgroup or
other resource devoted to your server software.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Thu, 18 Jun 1998 23:02:27 GMT
From: calacreek@my-dejanews.com
Subject: AXS 2.0 Date
Message-Id: <6mc6a3$ulg$1@nnrp1.dejanews.com>

I have picked up AXS 2.0 from www.xav.com and I have a little problem.

I am in Pacific Time (USA) and my virtual hosting service is in Mountain
Time.  This means that all the time-stamped data is one hour later.  I would
like to rework the script to correct that problem.

Does anyone know how to subtract an hour from a variable (in the script, it
is part of an array $terms)?  Of course, this script is in perl, most likely
version 5.

Thanks
__________________________
Lawrence R. Kellie     mailto:webmaster@calacreek.com
Cala Creek Website Design      http://www.calacreek.com
Affordable and elegant website design
Personal mail:  mailto:lawrence@calacreek.com

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 18 Jun 1998 22:37:00 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Beginner
Message-Id: <6mc4qc$ocq@news-central.tiac.net>

In article <358962EF.DB81ABA0@cvn.net>, Chris Miller  <apminc@cvn.net> wrote:
>I'm in the process of trying to teach myself Perl.  If anyone has any
>suggestions on where to start such as literature, etc.  I'd appreciate
>it.

Learning Perl - 2nd edition (or if appropriate the Win 32 version) both
published by O'Reilly and linked to from http://perl.oreilly.com/ are
reasonable starting points.  

If you want a meatier tutorial introduction to perl the Jon Orwant's Perl
5 Interactive Course (make sure you get the one with Certified Edition
emblazoned on it) is well worth a look.

Tom Christiansen has some updated book reviews on www.perl.com which you
might want to read. 

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 18 Jun 1998 21:55:05 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Checking returns from system calls (Was: Please HELP convert a SIMPLE 2 Line DOS Batch File!!)
Message-Id: <6mc2bp$1dg@mozo.cc.purdue.edu>

lr@hpl.hp.com (Larry Rosler) writes:

}WIBNI (Wouldn't It Be Nice If) Perl had a cheap robust mechanism for 
}handling software exceptions, so that all the clutter caused by chacking 
}of Perl functions that invoke system calls (like 'open' -- "always check 
}your open()") could be handled centrally.

I agree.  In fact, I think that one of the strengths of perl over a
lot of other languages is the lack of "always check this if you
ever do that" type of rules that a programmer has to remember.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: Thu, 18 Jun 1998 19:38:16 -0400
From: Li Xiaoning <lxn@inet.net>
Subject: Ctrl+C disable in perl program 
Message-Id: <3589A4E8.27E9A1F5@inet.net>

I am writing a system configuration program in perl, I want to disable
control+C in program. appreciate for any idea on that.



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

Date: Thu, 18 Jun 1998 17:00:40 -0500
From: "Vincent M. Probasco" <probavm@h8mail.laf.cat.com>
Subject: Re: Faster Search
Message-Id: <35898E08.172C14DA@h8mail.laf.cat.com>

Thanks to everyone who replied. I'll give an index a try.

Vince



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

Date: Thu, 18 Jun 1998 17:22:01 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: filehandles
Message-Id: <358984F9.383F2C02@matrox.com>

Wirehead wrote:
> 
> I don't have much experience in perl. Is there an easier way to do this?

Define easier. Is this too long? Is it too complicated? Is it too slow?
Is it wrong altogether? Does it suck at soccer?

Boy, is that Ronaldo guy good or what!

> 
> #!/usr/local/bin/perl5
> 
> print "Please enter the subnet in which you would like to scan:\n";
> chomp($_=<STDIN>);
> open(FINDIT, "grep $_ /etc/hosts |");
> open(FINDOUT, ">temp1");
> while (<FINDIT>){
>         print FINDOUT "$_";
> }
> close FINDIT;
> close FINDOUT;
> exit;
> 
> --
> 
> thanks.
> -J

-- 
Ala Qumsieh		|  No .. not just another
ASIC Design Engineer	|  Perl Hacker!!!!!
Matrox Graphics Inc.	|
Montreal, Quebec	|  (Not yet!)


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

Date: Thu, 18 Jun 1998 19:11:32 -0400
From: "Matthew Feinberg" <matt@monmouth.com>
Subject: Get IP Address for Server Name
Message-Id: <6mc63o$adh$1@news.monmouth.com>

Hi,

Does anyone have a script that will get the IP address for a servername
given.

i.e.

 ./findip  server.somedomain.com

returns  ip address i.e. 209.191.4.200

Thanks




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

Date: Thu, 18 Jun 1998 16:14:53 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: Matthew Feinberg <matt@monmouth.com>
Subject: Re: Get IP Address for Server Name
Message-Id: <35899F6D.A732937D@sirius.com>

Matthew Feinberg wrote:
> 

> Does anyone have a script that will get the IP address for a servername
> given.

print join '.', unpack 'C4', gethostbyname $ARV[0];

-- Jim Bowlin


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

Date: Thu, 18 Jun 1998 18:01:19 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: How to sort alphanumeric string using "sort" function
Message-Id: <35898E2F.456BC249@negia.net>

Margaret Lee wrote:
> 
>   Hi,
> 
>   In my program I have alphanumeric strings hash keys like the
> following:
>     abc1d2, abc11d2, abc2d2, abc2e, def<0>, def<11>, def<1> def<2>
> 
>   I would like to retrieve the keys in the following order:
>     abc1d2, abc2d2, abc11d2, abc2e, def<0>, def<1>, def<2>, def<11>
> 

well, this works for your sample data above, but i have a funny feeling
that you'll need to modify it further if you have other demands.

@keys = qw( abc1d2 abc11d2 abc2d2 abc2e def<0> def<11> def<1> def<2> );
@sorted = map $_->[0],
          sort { $a->[1] cmp $b->[1] or
                 $a->[3] cmp $b->[3] or
                 $a->[2] <=> $b->[2] }
          map [$_,/(\D+)(\d+)(\D+)/], @keys;

in summary, this is a pretty typical Schwartzian Transform. first we
build an anonymous array reference that contains:

  [ original key, 1st non-digits, 1st digits, 2nd non-digits ]

then we sort the list of anonynous array references based on:

    primary: 1st non-digits (element 1)
  secondary: 2nd non-digits (element 3)
   tertiary: 1st digits (element 2)

then we extract our original data from the ordered references and do
with
it whatever we please. of course this can be extended to include more
bits of the original keys if needed.

cheers,

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: Thu, 18 Jun 1998 21:59:33 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: if (something eq "somethingfgjhf")
Message-Id: <6mc2nh$5q8$3@strato.ultra.net>

[ posted and mailed ]

"Kenneth" <kenkim@gncom.com> wrote:
->     if ($something =~ /$match/i)

You're missing a caret here. He said the first 8 digits.
You also should use the \Q & \E operators here. Some systems are a little 
fussy about variables in regexes

        if($something =~ /^\Q$match\E/i) { ... }

Then again, this has been thrown around here for the longest time and with a 
fixed length match, substr is atleast 3 times faster than using a regex.

       if  (substr($something, 0, 7) eq substr($match, 0, 7)) { ... }

-> 
-> Brian Charles wrote in message <3589630B.469C767C@orst.edu>...
-> >Hi,
-> >Is it possible to only test the first 8 characters/digits to see if a
-> >statement is true?
-> >
-> >I need the following statement to be true as long as the first 9
-> >characters are the same. I don't care about what follows the 9
-> >characters.
-> >
-> >if (something eq "somethingetdsfg.....................")
-> >
-> >then....
-> >
-> >
-> >Thanks
-> >Brian
-> >
-> 
-> 

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
    and hang up when the recording starts. "


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

Date: Thu, 18 Jun 1998 22:15:57 GMT
From: pehanna@my-dejanews.com
Subject: Re: if (something eq "somethingfgjhf")
Message-Id: <6mc3it$qm0$1@nnrp1.dejanews.com>


> I need the following statement to be true as long as the first 9
> characters are the same. I don't care about what follows the 9
> characters.
>
> if (something eq "somethingetdsfg.....................")

How about anchoring a pattern match:

my $fullword = "somethinggetdsfg......";
if ($fullword =~ /^something/)

--
Phil Hanna

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 18 Jun 1998 22:23:05 GMT
From: dalonso@u.washington.edu (Darwin O.V. Alonso)
Subject: Re: if (something eq "somethingfgjhf")
Message-Id: <6mc409$g7s$1@nntp6.u.washington.edu>


#!/usr/local/bin/perl -w
@ar = qw( somethingblue bluesomething); 
for ( @ar ){  
   if ( /^something/){  
      print $_, ": matches\n";
   }else{ 
       print $_, ": no-match\n";
   } 
}

Gives:
somethingblue: matches
bluesomething: no-match



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

Date: Thu, 18 Jun 1998 22:58:36 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: if (something eq "somethingfgjhf")
Message-Id: <6mc62s$u7a$1@nnrp1.dejanews.com>

In article <3589630B.469C767C@orst.edu>,
  Brian Charles <brian.charles@orst.edu> wrote:
>
> Hi,
> Is it possible to only test the first 8 characters/digits to see if a
> statement is true?
>
> I need the following statement to be true as long as the first 9
> characters are the same. I don't care about what follows the 9
> characters.
>
> if (something eq "somethingetdsfg..........................")
>
> then....
>
> Thanks
> Brian

So really your testing "somethingetdsfg........" against "something". If the
first 9 characters of "somethingetdsfg........" match "something" then you
want to hear about it.

Why eq ? Why not regex? eg:

if (somethingorother =~ /something/) { print "True\n" }

I would go further and put your strings into scaler variables and use those in
the test. eg:

$string_to_match = "something";
$string_to_test = "somethingorother";
if ($string_to_test =~ /$string_to_match/) { print "True\n" }

Check your perldoc perlre : you can anchor your regex to match at the front of
the line, end of the line, both, etc.

Hope that helps.

Patrick Timmins
U. Nebraska Medical Center

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 18 Jun 1998 17:15:43 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Little help on grabbing text
Message-Id: <3589837F.A379C13B@matrox.com>

Michael S. Brito, Jr. wrote:
> 
> I'm kinda new to this so bear with me:
> 
> I'm writing a script that will grab a users e-mail address from a form
> that he/she fills out. It will then slap it in a file (email.txt). Then
> It will grab whatever is in the file body.txt and use it for the body of
> an e-mail which is then sent to that users input (or e-mail address).
> One problem though, I can only grab the first line of body.txt! I don't
> know how to grab the entire thing and send it away. I *think* it's a
> FOREACH thing but I experimented with no luck.
> 

 [snip some code]

> $filename = "body.txt";
> open(INF,$filename);

ALWAYS check the result of your open statements!
open INF, "body.txt" or die "Can't open body.txt: $!\n";

> $indata = <INF>;

You are reading the first line only! To read the entire thing, you can
do any of the following:

1) @indata = <INF>;  # This creates an array. Each element is a 
                     # line from the file

2) $/ = "";          # This redefines your input record separator
   $indata = <INF>;  # Now the whole file is read as one scalar, with
                     # carriage returns and all.

3) while (<INF>) {
   	print MAIL "$_";
   }

> close(INF);

again, you should check the result of the close.
> 
> print MAIL "$indata\n";
> 
> close(MAIL);
> 
> print "Location:http://208.XXX.XXX.XXX/thanks.html\n\n";
> 
> !--------------- EOF --------------------!
> 
> Thanks for any help u can offer,
> 
>                                     Mike : mike@newfangled.com

Buy yourself a copy of the Llama book by R. Schwartz and T.
Christiansen.

-- 
Ala Qumsieh		|  No .. not just another
ASIC Design Engineer	|  Perl Hacker!!!!!
Matrox Graphics Inc.	|
Montreal, Quebec	|  (Not yet!)


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

Date: 18 Jun 1998 22:06:28 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Making Life Easy - Templates, XSSI, Variables and such
Message-Id: <6mc314$b8c$2@marina.cinenet.net>

Steve Linberg (linberg@literacy.upenn.edu) wrote:
[snip]
: > I'm basically just looking for ways to make updating my site easier.  The
: > color problem is just one example.  I'd like to use a template, variables,
: > Perl, whatever... so that I will have to change a value once, and only once.
: > 
: > Is there any way to do this?
: 
: Yes, there are many ways to do this.  Head over to CPAN and browse the
: module list.  There are more HTML/text compilers than you can shake a
: stick at.  Or you could write one of your own.

Or, if you don't insist on a Perl solution, take a look at cascading style
sheets, which accomplish *exactly* what you're trying to do within the
framework of HTML itself.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Thu, 18 Jun 1998 16:19:07 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: Geoff Hudik <geoffhudik@cyberdude.com>
Subject: Re: Making Life Easy - Templates, XSSI, Variables and such
Message-Id: <3589A06B.22792E2F@sirius.com>

Geoff Hudik wrote:
> 
> I'm considering ways to make updating my site easier (before it gets too
> big).  I'm thinking that I can use Perl and/or XSSI to do this.  Say, for
> example, that I want to change colors on my site, but I don't want to go
> through and edit every individual web page.  I could do the following:
> 
> <!--#set var="color" value="#99CCCC" -->
> 
> <td width="26%" bgcolor="<!--#echo var='color' -->">
> 
> but that only works on one page.  Is there a way to use some sort of
> "global" variable so I can change the color variable once and it will change
> every color attribute on my site?  I thought I'd be clever and use a SSI to
> include a file full of nothing but variables, but this did not work.
> 
> I'm basically just looking for ways to make updating my site easier.  The
> color problem is just one example.  I'd like to use a template, variables,
> Perl, whatever... so that I will have to change a value once, and only once.
> 
> Is there any way to do this?

I've been using a freeware program called htp to do this.
iMatix (www.imatix.com) also has a Perl program called htmlpp
that does a similar thing.  I think htp is the best though.
It has a learning curve, but once you get used to it it is 
perfect for what you want to do.

-- Jim Bowlin


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

Date: 18 Jun 1998 23:31:20 GMT
From: "Ron Savage" <rpsavage@ozemail.com.au>
Subject: Re: Making Life Easy - Templates, XSSI, Variables and such
Message-Id: <01bd9b11$71cab020$43ea1286@steelres-pcm657.resmel.bhp.com.au>

Geoff,
This problem has been solved by the author of Text::MetaText. Download &
install it. I used it to write my web page factory, which loops over all
desired pages & customises a template to produce each page.

[snip]



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

Date: 18 Jun 1998 23:20:31 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Matching Question
Message-Id: <6mc7bv$rae@news-central.tiac.net>

In article <35898831.83467560@news.smart1.net>,
Ron Barnhart <barnhart@freewwweb.com> wrote:
>I forgot to include my email address in the above post.  If you could
>send an email for information it would be helpful.  Thanks.
>
>Ron Barnhart
>barnhart@freewwweb.com

Regular expressions are quite terse representations of patterns against
which a program will try and match patterns.  Perl's regular edxpressions
are more than regular regular expressions.

The places I would look are:

  perldoc perlre

the perl manual page for regular expressions and Jeffrey Freidl's book
published by O'Reilly (see http://www.oreilly.com ) called Mastering
Regular Expressions.

  $found = $string =~ /ab/;

would look for the character a followed by the character b in the value in
$string.  If that sequence was found then $found would be set to 1,
otherwise to a false value.

 . can be used to represent any character (except \n, usually) so

  $found = $string =~ /a.c/;

would look for the sequence a then any character then c in $string.

The regular expression specifies a small program to be run by the regular
expression engine on data sets, and some of the examples in the perlre
manual pages should help you get going.

Freidl's book is an invaluable resource if you want to understand regexes,
not just in perl but in a nuber of other utilities and languages.

Hope this helps,

Mike

(I have assumed bytes are characters here...)

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 18 Jun 1998 23:43:46 GMT
From: "Ron Savage" <rpsavage@ozemail.com.au>
Subject: Re: Moving application from DOS to a GUI.
Message-Id: <01bd9b13$2e92d2e0$43ea1286@steelres-pcm657.resmel.bhp.com.au>

Also check 'The Perl Journal' at http://tpj.com.
In particular see Issue #5's article on PDL The Perl Data Language.

[snip]



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

Date: Thu, 18 Jun 1998 22:22:19 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Net::Ftp module
Message-Id: <6mc427$5q8$4@strato.ultra.net>

[ posted and mailed ]

Wirehead <allen@retina.net> wrote:
-> I had been looking around for examples of an ftp client until someone
-> mentioned something about the Net::Ftp module. I hear theres an example
-> in the  modules book within the perl kit. Unfortunately, I don't have
-> the money at this time to get the kit. Are there any examples or info
-> around concerning this module? I'm sure its very simple to implement.

Are you too poor to type   "perldoc ftp"   and hit the enter key?


HTH

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
    and hang up when the recording starts. "


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

Date: 18 Jun 1998 23:21:22 GMT
From: c.c.eiftj@98.usenet.us.com (Rahul Dhesi)
Subject: ohsir.pl : suggestive perl poem
Message-Id: <6mc7di$sfj$1@samba.rahul.net>

#! /usr/local/bin/perl
# (c) Copyright Rahul Dhesi 1998; permission granted to copy provided
# this copyright statement is preserved.
# I claim no copyright over the output, only over the perl code.
# WARNING:  The output is a suggestive poem suitable for adults.

for ($line = "oh sir please don't touch me"; $count++ < 8; ) {
   print $line, " ...\n"; $line =~ s/ \S+$//; sleep 3; }
# end


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

Date: Thu, 18 Jun 1998 17:03:01 -0800
From: no_spam@to_hotcity_email_address.com (J. Belton McClure)
Subject: PERL & blobs
Message-Id: <no_spam-ya02408000R1806981703010001@news.wco.com>

Hello all,

   I want to insert a blob into an Oracle database but I'm not
quite sure how to do so. Does anyone have any suggestions? A module
that does this would be VERY nice!

Thanks!
J. Belton McClure
(XXjmcclure@Xhotcity.Xcom -- Remove the X's to respond)


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

Date: 18 Jun 1998 18:38:41 -0500
From: les@MCS.COM (Leslie Mikesell)
Subject: perldoc vs. pod2man?
Message-Id: <6mc8e1$aj$1@Jupiter.Mcs.Net>

Is there a way to use the lookup capability of perldoc but get
to the man-format output so you can feed it to troff instead
of nroff?  Or is there some equivalent way to tell pod2man
what to find?

  Les Mikesell
   les@mcs.com 


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

Date: 18 Jun 1998 22:25:40 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Pod::Text -- Unix only?
Message-Id: <eli$9806181821@qz.little-neck.ny.us>

In comp.lang.perl.misc, Tom Christiansen  <tchrist@mox.perl.com> wrote:
>     pehanna@my-dejanews.com writes:
> :Many Perl scripts need to operate in both Unix and Windows NT environments
> There you go with that *both* thing.  "This runs on `both' browsers,"
> you'll hear people say.  Ptui.

Many Perl scripts need to operate in both Unix and non Unix environments.
Pehanna just has a narrow view of "non Unix." HTH.

> I am a carpenter.  I use tools.  Perl is a glue factory, a tool shop.
> You'll take away my tools when you prise them from my cold, dead hands.

You seem to be avoiding the issue.

Elijah
------
thinks few things run "on" browsers


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

Date: 18 Jun 1998 23:48:36 GMT
From: phoenixl@aol.com (Phoenixl)
Subject: Running a VT100 perl script in Windows 95
Message-Id: <1998061823483700.TAA29058@ladder01.news.aol.com>

A friend has given me a perl script which he uses on his UNIX box.  I can get
it to run on my Windows 95 machine, but the output is VT100 cursor movement
strings.  The strings are just in a couple of modules and I can easiky
substitute
other cursor movent strings.  Can someone tell me where I could find cursor
movement strings for the MS-DOS window?

Thanks very much.


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

Date: Thu, 18 Jun 1998 22:39:18 GMT
From: defike@ilstu.edu..spam.not (Don)
Subject: Re: Socket program help
Message-Id: <358a96e6.35421853@news.ice.net>

On Thu, 18 Jun 1998 18:28:45 GMT, defike@ilstu.edu..spam.not (Don)
wrote:

Solution:  $socketaddr != $sockaddr


>Below is the code for a client script that I basically lifted from a
>book.  Unfortunately the script fails at line 45 following the bind(S,
>$this) statement.  Since I am writing this to learn sockets I don't
>know what is causing this error.  Could some one help me find the
>error of my ways...
>
>Thanks,
>
>Don
>defike@ilstu.NOSPAM.edu
>
>#! /usr/local/bin/perl
>
># client.pl, sockets 101
>
>use Socket;
>
>($them,$port) = @ARGV;
>
>$port = 2345 unless $port;
>$them = 'localhost' unless $them;
>
>$SIG{'Int'} = 'dokill';
>
>sub dokill {
> kill 9, $child if $child;
>}
>
>chop($hostname = `hostname`);
>
>($name, $aliases, $proto) = getprotobyname('tcp');
>
>($name, $aliases, $port) = getservbyname($port, 'tcp') unless $port =~
>/^\d+$/;
>
>print "Using port $port to connect to server on host $them...\n";
>
>($name, $aliases, $type, $len, $thisaddr) = gethostbyname($hostname);
>
>($name, $aliases, $type, $len, $thataddr) = gethostbyname($them);
>
>#if (socket(S,1,1, 0))
>if (socket(S,AF_INET, SOCK_STREAM, $proto)) {
> print "Socket creation succeeded.\n";
>}
>else {
> die $!;
>}
>
>$socketaddr = 'S n a4 x8';
>$this = pack($sockaddr, AF_INET, 0, $thisaddr);
>$that = pack($sockaddr, AF_INET, $port, $thataddr);
>
>#### This is where it fails, states invalid arguement  ####
>
>if (bind(S, "$this")) {    
> print "Bind succeeded.\n";
>}
>else {
> die $!;
>}
>
>if (connect(S, $that)) {
> print "Connect succeeded.\n";
>}
>else {
> die $!;
>}
>
>select(S);
>$| = 1;
>
>select(STDOUT);
>
>if ($child = fork) {
> while (<STDIN>) {
>  print S;
> }
> sleep 3;
> 
> do dokill();
>}
>else {
> while (<S>) {
>  print "Server: $_";
> }
>}
>  



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

Date: Thu, 18 Jun 1998 17:07:09 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: SORTING HASHES (THE NEWBIE WAY!!)
Message-Id: <3589817D.67E9E4D7@matrox.com>

Stephan Carydakis wrote:
> 
> Hello All,
> 
> I know I say this on every post I make, but please excuse my ignorance
> as I am a newbie Perl hacker(who is a full time musician).
> 
> My Question(s):
> Can one sort a HASH on the Values??
> Or is there a method to do this somehow??
> 

Straight from the perlfunc manpages:

     # this sorts the %age associative arrays by value            
     # instead of key using an inline function                 
     @eldest = sort { $age{$b} <=> $age{$a} } keys %age;


> 
> I've read through the camel and cant seem to find anything that will
> solve my problem although I bet there is ay??

Hmmm... read again .. more thoroughly .. it's there!

> 
> If someone could point me in the right direction or offer their learned
> opinion, I would greatly appreciate it. I'm not asking for the code to
> solve this problem as I do enjoy trying to solve my problems on my
> own.(but code would be nice too :-] )

Well .. asking just destroys the fun (in my opinion)!

> 
> Thanks
> ____________________________________________
> Stephan Carydakis    steph@hotkey.net.au
> 
>     "I'm a Musician.......What's Software?"
> 
> print "Howdy, world!\n";
> ____________________________________________

-- 
Ala Qumsieh		|  No .. not just another
ASIC Design Engineer	|  Perl Hacker!!!!!
Matrox Graphics Inc.	|
Montreal, Quebec	|  (Not yet!)


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

Date: Thu, 18 Jun 1998 21:06:15 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Sorting IP's - Help!
Message-Id: <Pine.GSO.3.96.980618140510.13348q-100000@user2.teleport.com>

On Thu, 18 Jun 1998, David Pitts wrote:

> What I am trying to do is sort this list by ip 

I think what you want could be accomplished by comparing the IP addresses
(as packed strings). Hope this helps! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 18 Jun 1998 22:44:13 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Sorting IP's - Help!
Message-Id: <6mc57t$ocq@news-central.tiac.net>

In article <3589744E.794B@boeing.com>,
David Pitts  <david.pitts@boeing.com> wrote:
>Hi, 
>I have a flat file database that has entries that look something like
>this: (actually, it is colon delimited not space...)
>esg33           144.113.158.26  700534  40-81.2 P2
>esg34           144.113.138.20  700535  40-81.2 P2
>esg35           144.113.158.32  700536  40-81.2 P2
>esg36           144.113.83.50   700537  40-85.1 D1
>esg37           172.18.36.134   698845  40-87.4 D13
>esg38           144.113.83.64   700538  40-85.1 C1
>esg39           144.113.83.78   700539  40-85.1 D2
>
>What I am trying to do is sort this list by ip (there are thousands of
>entries).  Here is what I have tried:

You might want to read one of the collection of articles Tom Christiansen
has collected together by various people on www.perl.com.  In particular

http://www.perl.com/CPAN-local/doc/FMTEYEWTK/sort.html

might be of use.

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Thu, 18 Jun 1998 22:37:10 GMT
From: "Marty D. Cudmore" <mdc0788@fugue.ca.boeing.com>
Subject: Re: Sorting IP's - Help!
Message-Id: <35899696.58DA@fugue.ca.boeing.com>

David Pitts wrote:
> 
> Hi,
> I have a flat file database that has entries that look something like
> this: (actually, it is colon delimited not space...)
> esg33           144.113.158.26  700534  40-81.2 P2
> esg34           144.113.138.20  700535  40-81.2 P2
> esg35           144.113.158.32  700536  40-81.2 P2
> esg36           144.113.83.50   700537  40-85.1 D1
> esg37           172.18.36.134   698845  40-87.4 D13
> esg38           144.113.83.64   700538  40-85.1 C1
> esg39           144.113.83.78   700539  40-85.1 D2
> 
> What I am trying to do is sort this list by ip (there are thousands of
> entries).  Here is what I have tried:
> foreach $noder (@new_nodes_list) {
>         ($node,$erms,$ip,$building,$slave,$colbay)=split(/:/,$noder);
>         ($ip1,$ip2,$ip3,$ip4)=split(/\./,$ip);
> 
>         $ip1{$node." ".$erms." ".$ip1.".".$ip2.".".$ip3.".".$ip4."
> ".$building." ".$slave." ".$colbay} = $ip1;
>         $ip2{$node." ".$erms." ".$ip1.".".$ip2.".".$ip3.".".$ip4."
> ".$building." ".$slave." ".$colbay} = $ip2;
>         $ip3{$node." ".$erms." ".$ip1.".".$ip2.".".$ip3.".".$ip4."
> ".$building." ".$slave." ".$colbay} = $ip3;
>         $ip4{$node." ".$erms." ".$ip1.".".$ip2.".".$ip3.".".$ip4."
> ".$building." ".$slave." ".$colbay} = $ip4;
> 
>  } # end foreach $noder (@new_nodes_list)
> 
> @keys = sort { $ip1{$a} <=> $ip1{$b} } keys %ip1 or
> sort { $ip2{$a} <=> $ip2{$b} } keys %ip2 or
> sort { $ip3{$a} <=> $ip3{$b} } keys %ip3 or
> sort { $ip4{$a} <=> $ip4{$b} } keys %ip4;
> 
> So, does anyone have a sorter that will work or see why this does not?
>


Try this one, Dave.  This one looks for colon delimited file rather than
spaces as indicated in your post.

# NOTE: In the case of duplicate IP Addresses, only the last duplicate
#       encountered in the input will be saved.

# Load the Ip Addresses from an input file
open(FH,"your_file_here") or die;
while (<FH>) {
    chomp;
    my ($field0, $ip, $field2, $field3, $field4) = (split ':', $_);
    $ips{$ip} = [$field0, $ip, $field2, $field3, $field4];
}

# Load up an anonymous hash of hashes of hashes of hashes!
for (keys %ips) {
    my ($a, $b, $c, $d) = split /\./, $_;
    $r->{$a}->{$b}->{$c}->{$d} = '';
}

# Sort and print
for $a (sort { $a <=> $b } keys %{$r}) {
    for $b (sort { $a <=> $b } keys %{$r->{$a}}) {
        for $c (sort { $a <=> $b } keys %{$r->{$a}->{$b}}) {
            for $d (sort { $a <=> $b } keys %{$r->{$a}->{$b}->{$c}}) {
                print (join ':',@{$ips{"$a.$b.$c.$d"}});
                print "\n";
            }
        }
    }
}
 

Cheers,

Marty D. Cudmore (Boeing)


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

Date: 18 Jun 1998 22:52:49 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Tied hash questions
Message-Id: <6mc5o1$ocq@news-central.tiac.net>

In article <35897BEB.F8BD2C9F@mci.com>, David Hinz  <David.Hinz@mci.com> wrote:
>How do I use a tied hash to find the first specfied key value and all of
>the subsequent key values matching a specific key value?
>
>I stored the values in the NDBM_File tied hash file and have now opened
>the file and can dump the data in the tied hash variable using:

Have you looked at the DB_File module (which makes use of Berkeley DB)
which allows your database to be based on a btree and lets you match
parital keys and may be useful to you.

  perldoc DB_File

will tell you if the module's manual pages are installed, and if they are
you might find them useful.

The web site for Berkeley DB is http://www.sleepycat.com/db. 

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 18 Jun 1998 23:24:55 GMT
From: huliang@almaden.ibm.com (Hu Liang)
Subject: Update with PERL CGI PROBLEM
Message-Id: <6mc7k7$hh0@fox.almaden.ibm.com>

Hi,

Well, found a little prob.  IT seems the LC_ALL env is not set...so perl is 
reporting the warning and that was being interpreted as the header.

Is there a way to compile perl to have LC_ALL set to "C"?  I'm working on it, 
but if you know it, please drop me a line, THANKS!

huliang@almaden.ibm.com



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

Date: 18 Jun 1998 22:21:34 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Using PERL to do a remote TELNET
Message-Id: <6mc3te$ocq@news-central.tiac.net>

In article <6mbqn4$s6r$1@demon.uunet.ca>, Kenneth <kenkim@gncom.com> wrote:
>Im not sure what you mean bye getting a module.. how would I add a module
>and where do I get it from?

There's a network of ftp sites which keep an archive of perl bits and
pieces, CPAN - the comprehensive perl archive network.

My favourite way of getting to a site if I have a web browser to hand is
to visit http://www.perl.com and follow the Nearest CPAN Site link you
should find there.  Failing that the master ftp site is at ftp.funet.fi
under /pub/languages/perl/CPAN and you should find a list of mirror sites
there.  perlfaq2 talks about CPAN, the command perldoc perlfaq2 should
display some useful information.

If you can write to perl's installation directories then you typically say
(on a unix-ish system... in a spare directory somewhere)

  gunzip -c Module-Name-x.yy.tar.gz | tar xf -
  cd  Module-Name-x.yy
  perl Makefile.PL
  make
  make test
  make install

the last step may need to be done as a special user, and your tar may deal
with gzipped files by itself.

If you aren't allowed to write into perl's installation direcories then
you might say

  perl Makefile.PL LIB=${HOME}/lib

which arranges for the module to be installed in lib in your home
directory.  The ExtUtils::MakeMaker man page (viewable with perldoc) is
worth a read to see what's going on.  If you install in a private
directory you might want to set the PERL5LIB environment variable so perl
automatically searches it, the perlrun documentation describes PERL5LIB.

Hope this helps,

Mike


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Thu, 18 Jun 1998 18:21:11 -0400
From: Cornelius Griffin <escrubb@att.net>
Subject: Re: Using STDIN as a symbolic reference?
Message-Id: <6mc3s3$of4@bgtnsc03.worldnet.att.net>

Larry & Tom,

    Changed it & it works. Thank you both.

Cornelius



Tom Phoenix wrote:

> On Thu, 18 Jun 1998, Cornelius Griffin wrote:
>
> > Subject: Using STDIN as a symbolic reference?
>
> Are you sure you want symbolic references? Perhaps you should be using
> true references instead.
>
> >     I am trying to read in a string from STDIN, then use that string as
> > a symbolic reference. For Example:
> >
> > $i = <STDIN>;
> > $$i = "help";
>
> Okay, so if you enter "fred" and a newline at the keyboard (or whatever),
> you've just set a variable with that five-character name. Note that that
> name is not syntactically valid for a normal variable name, of course.
> Does that show you what's happening? Good luck!
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/





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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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