[10359] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3953 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 12 11:07:36 1998

Date: Mon, 12 Oct 98 08:01:33 -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           Mon, 12 Oct 1998     Volume: 8 Number: 3953

Today's topics:
        Perl inputStream Type?? (Lee Prissel)
        Reading binary data? (Jonas Bofjall)
        Search word for certain characters? <benderle@mindspring.com>
    Re: Search word for certain characters? (Mark-Jason Dominus)
        Sorting hash by value, not key <carriec@doc.state.vt.us>
    Re: Sorting hash by value, not key (M.J.T. Guy)
    Re: Sorting hash by value, not key <ludlow@us.ibm.com>
    Re: Square Root In PERL <mikeg@slpma8.ed.ray.com>
        Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
    Re: use autouse problem in perl 5.004 (M.J.T. Guy)
        WIN32::ADMINMISC & Domain Names <john_scrimsher@ex.cv.hp.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 12 Oct 1998 14:47:39 GMT
From: lpp@meara.rchland.ibm.com (Lee Prissel)
Subject: Perl inputStream Type??
Message-Id: <6vt4qb$1c30$1@rchnews.rchland.ibm.com>


Greetings,
I have a perl subroutine that accepts a file handle as input. Example call to it: 
  subName(MY_HANDLE);
The caller may be dealing with a file or a multi-line scalar.  Is there a clean 
way to create a file handle associated with a scalar so the subroutine with the 
input handle could be used?  

In other words, I' m looking for a perl equivalent of the Java and C++ InputStream 
types so the subroutine is independent of the actual input mechanism (file I/O 
verses in-memory buffer).

thanks in advance,


--
Lee Prissel
IBM (Server Group at Rochester, MN) 
Internet:    lpp@us.ibm.com



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

Date: 12 Oct 1998 12:05:24 GMT
From: m9418@abc.se (Jonas Bofjall)
Subject: Reading binary data?
Message-Id: <6vsra4$b4c$1@oden.abc.se>

How do I make struct's in Perl? I have the format of a binary data file
which I want to process, preferrably cross-platform so Perl knows whether it
is running on a platform with least significant byte first or last and can
swap MSB/LSB to suit multibyte structures.

  // Jonas <job@abc.se> [2:201/262.37]


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

Date: Mon, 12 Oct 1998 10:03:41 -0400
From: Brian Enderle <benderle@mindspring.com>
Subject: Search word for certain characters?
Message-Id: <36220C3D.E5FBD277@mindspring.com>

Is there a way to search a given word for characters other than letters
and numbers?  I wish to have a check for screen names and passwords that
will make sure there are no spaces and no characters othere than letters
and numbers.  I have tried to split the word and then do a foreach loop
on each character to check its ACSII value but am having no luck. (might
not have the split command correct:
        @checkName = split(//, $input{'Screen Name'});   )

Thanks in advance for any help!

Brian Enderle
www.pcgamex.com



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

Date: 12 Oct 1998 10:41:57 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Search word for certain characters?
Message-Id: <6vt4fl$cil$1@monet.op.net>

In article <36220C3D.E5FBD277@mindspring.com>,
Brian Enderle  <benderle@mindspring.com> wrote:
>Is there a way to search a given word for characters other than letters
>and numbers?  

if ($input{'Screen Name'} =~ /[^A-Za-z0-9]/) {
  print "Your screen name blows, dude.\n";
}

>I have tried to split the word and then do a foreach loop
>on each character to check its ACSII value but am having no luck. 

That is how you do it in C, but that is not how you do it in Perl.

You really need to get a book about Perl and read it.  If you keep
trying to write C in Perl, you'll suffer.



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

Date: Sat, 10 Oct 1998 22:33:47 -0400
From: "Carrie Coy" <carriec@doc.state.vt.us>
Subject: Sorting hash by value, not key
Message-Id: <36201905.0@news.state.vt.us>

I have:

while ( .......) {
  $count{$street} += 1;
}

Now I want to output hash in order of street frequency.   Is there a simple
trick?
--
Carrie Coy
Vermont Department of Corrections




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

Date: 12 Oct 1998 13:41:12 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Sorting hash by value, not key
Message-Id: <6vt0to$p5n$1@pegasus.csx.cam.ac.uk>

Carrie Coy <carriec@doc.state.vt.us> wrote:
>I have:
>
>while ( .......) {
>  $count{$street} += 1;
>}
>
>Now I want to output hash in order of street frequency.   Is there a simple
>trick?

Let's see what the FAQ has to say.

% perldoc -q sort

[snip]

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

[snip]


Looks like it might be relevant.


Mike Guy


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

Date: Mon, 12 Oct 1998 09:14:31 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Sorting hash by value, not key
Message-Id: <36220EC7.CA47B367@us.ibm.com>

Carrie Coy wrote:

> Now I want to output hash in order of street frequency.   Is there a simple
> trick?

The FAQ is your friend...

http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_do_I_sort_a_hash_optionaly

The documentation that came with Perl is also good reading.

-- 
James Ludlow (ludlow@us.ibm.com)
Disclaimer: This isn't technical support, and all opinions are my own.


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

Date: Mon, 12 Oct 1998 09:15:16 -0400
From: Michael Genovese <mikeg@slpma8.ed.ray.com>
To: diego@valleyservices.com
Subject: Re: Square Root In PERL
Message-Id: <362200E4.4BE7@slpma8.ed.ray.com>

Diego Acevedo wrote:
> 
> Is there a square root string or function in PERL?

Two :

1) perlfunc will point you to "sqrt".

2) You can always use "$x ** 0.5" to calculate the square root of $x.


MikeG


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

Date: 12 Oct 1998 13:59:53 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <6vt20p$ljm$2@info.uah.edu>

Following is a summary of articles spanning a 7 day period,
beginning at 05 Oct 1998 13:50:28 GMT and ending at
11 Oct 1998 22:08:16 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 1998 Greg Bacon.  All Rights Reserved.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Excluded Posters
================

perlfaq-suggestions\@mox\.perl\.com

Totals
======

Posters:  520
Articles: 1437 (551 with cutlined signatures)
Threads:  444
Volume generated: 2363.5 kb
    - headers:    1038.1 kb (20,536 lines)
    - bodies:     1239.6 kb (40,662 lines)
    - original:   824.9 kb (29,021 lines)
    - signatures: 84.4 kb (1,912 lines)

Original Content Rating: 0.665

Averages
========

Posts per poster: 2.8
    median: 1.0 post
    mode:   1 post - 316 posters
    s:      5.1 posts
Posts per thread: 3.2
    median: 2.0 posts
    mode:   1 post - 148 threads
    s:      4.5 posts
Message size: 1684.2 bytes
    - header:     739.7 bytes (14.3 lines)
    - body:       883.3 bytes (28.3 lines)
    - original:   587.8 bytes (20.2 lines)
    - signature:  60.2 bytes (1.3 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

   44    61.6 ( 40.2/ 21.3/ 15.1)  Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
   42    68.6 ( 38.5/ 26.5/ 13.0)  John Porter <jdporter@min.net>
   42    71.1 ( 27.1/ 39.2/ 27.8)  lr@hpl.hp.com (Larry Rosler)
   38    50.8 ( 29.6/ 16.7/ 10.9)  Tom Phoenix <rootbeer@teleport.com>
   33    59.6 ( 23.6/ 31.7/ 17.4)  Jonathan Stowe <gellyfish@btinternet.com>
   27    49.0 ( 20.7/ 21.3/ 12.8)  rjk@coos.dartmouth.edu (Ronald J Kimball)
   27    46.2 ( 14.1/ 32.0/ 25.3)  mjd@op.net (Mark-Jason Dominus)
   25    50.8 ( 21.0/ 29.8/ 14.5)  madame philosophe <mp@mkt2mkt.com>
   23    49.5 ( 19.7/ 29.8/ 16.6)  droby@copyright.com
   23    47.3 ( 20.4/ 21.3/  8.9)  abigail@fnx.com

These posters accounted for 22.5% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

  71.1 ( 27.1/ 39.2/ 27.8)     42  lr@hpl.hp.com (Larry Rosler)
  68.6 ( 38.5/ 26.5/ 13.0)     42  John Porter <jdporter@min.net>
  61.6 ( 40.2/ 21.3/ 15.1)     44  Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
  59.6 ( 23.6/ 31.7/ 17.4)     33  Jonathan Stowe <gellyfish@btinternet.com>
  50.8 ( 29.6/ 16.7/ 10.9)     38  Tom Phoenix <rootbeer@teleport.com>
  50.8 ( 21.0/ 29.8/ 14.5)     25  madame philosophe <mp@mkt2mkt.com>
  49.5 ( 19.7/ 29.8/ 16.6)     23  droby@copyright.com
  49.0 ( 20.7/ 21.3/ 12.8)     27  rjk@coos.dartmouth.edu (Ronald J Kimball)
  47.3 ( 20.4/ 21.3/  8.9)     23  abigail@fnx.com
  46.2 ( 14.1/ 32.0/ 25.3)     27  mjd@op.net (Mark-Jason Dominus)

These posters accounted for 23.5% of the total volume.

Top 10 Posters by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.986  (  9.4 /  9.5)      6  baillie@my-dejanews.com
0.982  ( 15.5 / 15.7)     14  fl_aggie@thepentagon.com (I R A Aggie)
0.892  (  8.6 /  9.7)      8  dragnet@internalysis.com (Marc Bissonnette)
0.860  (  3.8 /  4.4)      6  Robert Bell <rabell@ti.com>
0.856  (  2.1 /  2.5)      5  Brent Michalski <perlguy@inlink.com>
0.844  (  6.6 /  7.8)      6  ptimmins@netserv.unmc.edu (Patrick Timmins)
0.816  (  2.2 /  2.7)      5  "-Paul Coleman" <Paul.Coleman@CoSeCo.com>
0.790  ( 25.3 / 32.0)     27  mjd@op.net (Mark-Jason Dominus)
0.755  (  5.6 /  7.4)      6  Gareth Rees <garethr@cre.canon.co.uk>
0.733  (  5.4 /  7.4)      8  mgjv@comdyn.com.au (Martien Verbruggen)

Bottom 10 Posters by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.429  (  4.6 / 10.7)     13  ilya@math.ohio-state.edu (Ilya Zakharevich)
0.419  (  8.9 / 21.3)     23  abigail@fnx.com
0.399  (  1.1 /  2.7)      6  Tk Soh <r28629@email.sps.mot.com>
0.395  (  2.7 /  6.7)      8  Matt Pryor <matt@whiterabbit.co.uk>
0.391  (  1.8 /  4.7)     13  "Commitman" <commitman@digitalnet.com.br>
0.342  (  1.2 /  3.5)      5  Fred Richards <gadget@bc.sympatico.ca>
0.300  (  3.0 / 10.1)     11  Justin Harvey <jbharvey@auspex.net>
0.240  (  0.9 /  3.9)      6  "Matthew O. Persico" <mpersico@erols.com>
0.203  (  0.8 /  3.8)      5  WMWilson <m.v.wilson@erols.com>
0.163  (  0.7 /  4.3)      7  Hongwei <howel88@cyberway.com.sg>

59 posters (11%) had at least five posts.

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   67  Are there any "perl.newbie" group or forum?
   21  "Many Jars" Mystery
   19  Problems Using a Compare Subroutine with Sort
   18  NEEDED: A good perl programer to...
   18  How do I use die?
   17  send geroge reese (was Re: Call for Participation: Python Conference)
   15  Hrm. Linguistic Quandry
   15  How to match exactly x occurrences of a character
   15  Data Search Question
   15  Back button in Perl?

These threads accounted for 15.3% of all articles.

Top 10 Threads by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Subject
--------------------------  -----  -------

 134.7 ( 58.0/ 73.0/ 50.1)     67  Are there any "perl.newbie" group or forum?
  44.0 ( 18.1/ 21.5/ 10.6)     17  send geroge reese (was Re: Call for Participation: Python Conference)
  38.5 ( 19.0/ 18.8/  8.5)     19  Problems Using a Compare Subroutine with Sort
  33.0 (  9.9/ 22.6/ 12.2)     13  Difficulty with HTML & Perl & CGI
  32.7 ( 10.8/ 21.0/ 15.7)     15  Data Search Question
  29.9 ( 13.7/ 15.1/  8.4)     18  How do I use die?
  29.8 (  8.3/ 20.7/  7.8)     10  Can't send mail via telnet programmatically
  29.7 ( 15.9/ 12.9/  7.6)     21  "Many Jars" Mystery
  28.0 ( 15.2/ 11.9/  8.4)     18  NEEDED: A good perl programer to...
  26.3 ( 11.6/ 12.8/  8.7)     15  Back button in Perl?

These threads accounted for 18.0% of the total volume.

Top 10 Threads by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.813  (  4.1/   5.0)      6  Opening Perl documentation
0.765  (  2.5/   3.3)      5  Exporting environment variables to parent shell
0.757  (  1.3/   1.7)      7  Compile
0.753  (  4.4/   5.9)      7  sort with dynamic sort expression help
0.752  (  3.3/   4.4)      5  cgi-lib.pl vs CGI.pm?
0.750  (  6.2/   8.3)     11  Passing Variables: $_ vs. @_
0.749  (  3.3/   4.4)      6  Extracting muliple values from a hash
0.747  (  1.7/   2.2)      5  What perl modules do I have???????
0.745  ( 15.7/  21.0)     15  Data Search Question
0.735  (  4.8/   6.5)      8  Perl and Novell Netware v4

Bottom 10 Threads by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.492  (  6.7 / 13.7)     15  How to match exactly x occurrences of a character
0.491  ( 10.6 / 21.5)     17  send geroge reese (was Re: Call for Participation: Python Conference)
0.458  (  2.6 /  5.6)      7  [OT] London.pm (was "Many Jars" Mystery)
0.453  (  2.6 /  5.9)      8  Matching Smallest Instance of a Pattern
0.451  (  8.5 / 18.8)     19  Problems Using a Compare Subroutine with Sort
0.450  (  1.7 /  3.9)      8  Search for forwardslash...how?
0.440  (  1.8 /  4.0)      5  CGI perl book
0.410  (  1.0 /  2.4)      5  eq on if statement causing problems with string
0.376  (  7.8 / 20.7)     10  Can't send mail via telnet programmatically
0.336  (  1.0 /  3.1)      5  Please help with time...

79 threads (17%) had at least five posts.

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      31  comp.lang.perl.modules
      14  comp.lang.java.programmer
      12  comp.lang.python
      11  comp.robotics.misc
      10  comp.lang.perl
       9  rec.games.programmer
       6  comp.lang.perl.moderated
       5  comp.lang.perl.tk
       5  comp.lang.c
       3  misc.jobs.offered

Top 10 Crossposters
===================

Articles  Address
--------  -------

      10  abigail@fnx.com
       8  Zenin <zenin@bawdycaste.org>
       5  linberg@literacy.upenn.edu (Steve Linberg)
       5  "Sean Rietze" <seanr@rmci.net>
       4  "Chris \"HTMLpro\" Alas" <rcpowerpro@geocities.com>
       4  rjk@coos.dartmouth.edu (Ronald J Kimball)
       4  Nick Moraitakis <nick@malloc.org>
       4  Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
       4  Ayanda Mabombo <9631917@ml.petech.ac.za>
       3  bavag@dds.nl (Buzz)


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

Date: 12 Oct 1998 14:04:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: use autouse problem in perl 5.004
Message-Id: <6vt29d$qa0$1@pegasus.csx.cam.ac.uk>

Brendan O'Dea <bod@compusol.com.au> wrote:
>The `=>' operator doesn't quote just `anything' to the left, only
>identifiers (ie. [^\W\d]\w*).  The perlop(1) documentation is a
>little ambiguous here:
>
>    [...] As of release 5.001, it also forces any *word* to the left of
>    it to be interpreted as a string.  [my emphasis]
>
>as `word' could be [mis-]interpreted to mean `string' (ie. \S+).

You can misinterpret the documentation any way you like, but in Perl
`word' always means "a sequence of \w characters not starting with a digit".

And no, this isn't as clear as it should be in the pod.


Mike Guy


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

Date: Mon, 12 Oct 1998 07:54:12 -0700
From: "John P. Scrimsher" <john_scrimsher@ex.cv.hp.com>
Subject: WIN32::ADMINMISC & Domain Names
Message-Id: <6vt56j$89v@hpcvsnz.cv.hp.com>

I have an NT perl script that utilizes AdminMisc to retrieve a list of
accounts from the PDC, and then checks the attributes of each account for
password age, so that I can notify users before there password expires.

The problem that I am running into is that some of our domains have dashes
"-" in them and Perl or AdminMisc cannot retrieve info from these domains.

Code snippet:

if( Win32::AdminMisc::GetUsers("$AccountDomain", "", \@List ) )
{
 foreach $username(@List)
 {
 if (Win32::AdminMisc::UserGetAttributes("$AccountDomain", "$username",
$FullName,
     $Password, $PasswordAge, $Privilege,
     $HomeDir, $Comment, $Flags, $Script))

$AccountDomain is passed as a command line arg, and may be a simple name
like "DOMAIN" which works fine, or a dashed name like "SERVER-DOMAIN" which
only returns data from the local machine that perl is running on.  I have
tried escaping the dash, using single quotes and hardcoding the domain name,
all to no avail.  If anyone has suggestions as to how to get dashes to work,
please let me know.

Thanks in advance,

John P. Scrimsher
john_scrimsher@hp.com




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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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