[8412] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2029 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 5 04:07:35 1998

Date: Thu, 5 Mar 98 01:00:40 -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, 5 Mar 1998     Volume: 8 Number: 2029

Today's topics:
    Re: $1 ? (Craig Berry)
    Re: @INC and lib (Craig Berry)
        Advise needed on Net::POP3 <koos_pol@nl.compuware.com>
        Anybody want a small puzzle? SPC@popstar.com
    Re: Are perl $SIG{} handlers inherently unsafe? (Gurusamy Sarathy)
    Re: Change Unix environment variable using Perl (Craig Berry)
        Clearing the screen <joshua@midwest.net>
    Re: Clearing the screen (Abigail)
        complex reg expression help (Mike Binkley)
    Re: complex reg expression help (Mike Binkley)
    Re: Displaying subdirectories and not filenames <koos_pol@nl.compuware.com>
        Good Perl book (Tom O'Neil)
    Re: Good Perl book <starman@regio-info.de>
    Re: Help with complex data structures. (Abigail)
        Java & Perl  which run faster on Unix? <blueshel@ms2.seeder.net>
    Re: Java & Perl  which run faster on Unix? <jdf@pobox.com>
    Re: Java & Perl  which run faster on Unix? (Martin Oakley)
    Re: Multidimensional Hashes <sottek@quiknet.com>
    Re: Paragraph mode and $/ variable <danboo@negia.net>
    Re: perl compiler? <joshua@midwest.net>
    Re: perl for win95? <etmgero@etm.ericsson.se>
    Re: Perl QRG(Perl Quick Reference Guide) (Johan Vromans)
    Re: Perl QRG(Quick Reference Guide) (Johan Vromans)
    Re: PERL question <jdludlow@millcomm.com>
    Re: Problems with Win32 Perl and network (Gurusamy Sarathy)
        Q: efficient usage of package? (Bernhard Ehrminger)
    Re: Summing Up Array Values - How Do I? <rjk@coos.dartmouth.edu>
    Re: use @records[$index] or $records[$index] ?? <jdf@pobox.com>
    Re: What am I doing wrong? <etmgero@etm.ericsson.se>
    Re: What I meant <uri@sysarch.com>
    Re: What I meant (Craig Berry)
    Re: What I meant <starman@regio-info.de>
        Win32::EventLog shans@fusi0n.com
    Re: Win32::EventLog <metcher@spider.herston.uq.edu.au>
        XS help sought; representing C structures <kagopi@deshaw.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 5 Mar 1998 07:17:19 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: $1 ?
Message-Id: <6dljhv$ar9$2@marina.cinenet.net>

Jeff Stewart (object01@cc.gatech.edu) wrote:
: What are the read-only variables $1, $2, $3, etc.?  How are they
: populated?

perldoc perlre

---------------------------------------------------------------------
   |   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: 5 Mar 1998 07:35:21 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: @INC and lib
Message-Id: <6dlkjp$ar9$4@marina.cinenet.net>

jabedi@its.brooklyn.cuny.edu wrote:
: I'm very new to perl and its way. I know from reading various posts that the
: following will add new perl library paths,
: 
: use lib '/new/perl/lib/dir';
: 
: However, I'm not very clear on where/when this is used. Is 'use' a shell
: command? Is the above command to be included in the Makefile? or some other
: configuration file? at compile time? Or perhaps, afterward? Can anyone please
: clear my questions? Thanks!

Nope, directly in the Perl script itself.  I frequently find myself 
putting multifile CGI scripts on NT webservers, 90% of which are 
misconfigured such that . (the current execution directory) is not the 
same as the directory in which the script is resident at CGI runtime.  
Thus, in order for use and require to find the other pieces of my app, I 
need to make the top of my 'main' script look something like this:

  #!/usr/bin/perl -w

  use strict;
  use libs '/absolute/path/to/script/dir';
  use MyModule1;
  use MyOtherModule;

  # Begin 'real' code...

HTH!

---------------------------------------------------------------------
   |   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, 05 Mar 1998 09:30:14 +0100
From: Koos Pol <koos_pol@nl.compuware.com>
Subject: Advise needed on Net::POP3
Message-Id: <34FE6296.450FA39A@nl.compuware.com>

(I asked this message a few days a ago, but no one responded. You are
not seriously thinking I am a spammer in disguise, do you :-) ? )

Our department is about to offer internal services which
-ideally- are *auto-triggered* by email (searching a database,
copying, downloading, report writing, etc)
Depending on the filters, specific actions need to be fired up.

Anyone can advise on the best tool to process the incoming email? (pop3
and smtp available)
* Procmail
* Mail::Tools
* Net::POP3

Rather new to unix but fairly good on Perl.
Thanks for your time!

-- 
Koos Pol
----------------------------------------------------------------------
S.C. Pol                                           tel: +31 20 3116122
PC Systems Administrator                   email: Koos_Pol@bigfoot.com
Compuware Europe                 PGP public key available upon request

      A little inaccuracy sometimes saves tons of explanation.
                        -- H. H. Munroe


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

Date: Mon, 02 Mar 1998 11:38:11 -0600
From: SPC@popstar.com
Subject: Anybody want a small puzzle?
Message-Id: <6deqp7$pd0$1@nnrp1.dejanews.com>

if ($deleted != "$file"){
        $count=0;
        until ($count >= $SIZE){
                $startmarker="<!--Begin $file-->";
                if ($FILES[$count] =~ $startmarker ){
                        $endmarker="<!--End of $file-->";
                        until ($FILES[$count] =~ $endmarker) {
                                undef($FILES[$count]);
                                $count++;
                        }
                        undef($FILES[$count]);
                }
                open (OUTPUT_FILE_LIST,">address/filename.html");
                print OUTPUT_FILE_LIST $FILES[$count];
                close(OUTPUT_FILE_LIST);
                $count++;
        }
$deleted=$file;
}

At present I'm trying to use this to delete a few lines from an array, the
array is a text file that has been loaded in. At the moment
the program deletes most of the section correstly but not the first one, it
just wipes the whole array (earlier on it was deleting everyone
but the last one).
I would be very greatful of any help given.

<--Begin 4.html-->
text
text
text
text
<--End 4.html-->


$SIZE is the number of fields in the @FILES array.


--------------------------------------
Steven Cook
BSc. (Hons) Media Technology
University of Teesside.
http://www.geocities.com/hollywood/5085
----------------------------------------


Thank you for any help you can provide.

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


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

Date: 5 Mar 1998 06:10:48 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Are perl $SIG{} handlers inherently unsafe?
Message-Id: <6dlfl8$obe@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <6dl3fl$oq3$2@mathserv.mps.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>You have seen the answer already.  (Though I would think that 
>
>  $SIG{CHLD} = sub { wait; return; };
>
>is safe in my OS/2 binary release, which contains a voodoo patch which
>is not allowed into the main distribution.)

You are mistaken about that last point.  perl5.004_04 has your mystery
patch (I even corrected a bug in it for 5.004_05!).  The devel versions
have it too.  (See mg.c/sighander())

 - Sarathy.
   gsar@umich.edu


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

Date: 5 Mar 1998 07:25:40 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Change Unix environment variable using Perl
Message-Id: <6dlk1k$ar9$3@marina.cinenet.net>

Zhaobin Zhu (zzhu@scl.ameslab.gov) wrote:
: two questions,
: 
: 1) Why I can not run in Perl
:     system ("setenv MY_EV  anyvalue");

Why do you think you can't run this?  Works for me.  Doesn't do what you 
appear to expect, though.

: 2) I can use
:     $ENV{"SHELL"}="anyvalue" to set
:    SHELL a new string within Perl. But
:   SHELL remains the same as before after exit
:   of my Perl program.

Yup.  That's a FAQ issue, actually (perlfaq8).

:   Any method to modify environment vatiables
:   in perl and make them permenant ?

You can't, in any entirely-within-Perl way.

---------------------------------------------------------------------
   |   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, 5 Mar 1998 00:02:51 -0600
From: "Joshua Frank" <joshua@midwest.net>
Subject: Clearing the screen
Message-Id: <6dlf59$bhq$1@usenet54.supernews.com>

Is there a simple way to clear the screen in perl 4? Without using tk or
anything like that.
-joshua@midwest.net




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

Date: 5 Mar 1998 08:40:12 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Clearing the screen
Message-Id: <6dlodc$4r5$4@client2.news.psi.net>

Joshua Frank (joshua@midwest.net) wrote on 1647 September 1993 in
<URL: news:6dlf59$bhq$1@usenet54.supernews.com>:
++ Is there a simple way to clear the screen in perl 4? Without using tk or
++ anything like that.


system ("shutdown -now");




Abigail
-- 
perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'


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

Date: Wed, 04 Mar 1998 23:08:43 -0600
From: Zena_Goddess_Of_Fire@mindless.com (Mike Binkley)
Subject: complex reg expression help
Message-Id: <Zena_Goddess_Of_Fire-0403982308430001@magmysmac.lfc.edu>

All right, I need to search a string for several regular expressions.  For
simplicities sake, we'll assume that we just have three regexps, as such:

$reg[0] = end
$reg[1] = ;
$reg[2] = +

Now, basically all that I want to do is take each regexp and replace it by
the regexp surrounded by spaces.

i.e.  "end of game" ---> " end of game"

and so forth.  However, I don't want the regexp to acquire the spaces if
its part of a word.

so "surrender" would not become "surr end er"

How do I do this?

The code I've got is:

   foreach $value (@reg){$_ =~ s/\W\Q$value\E\W/ $value /g};

I need the value quoted because some of the actual strings I'm searching
for contain MetaCharacters.  I was hoping that surrounding it by word
boundaries on either side would do the trick, but it doesn't seem to.

this still turns "bend" into "b end" and it leaves "thing," as "thing,"
instead of "thing , "



Now, I can do it like this:

   foreach $value (@reg){
      if ($value !~ /[^a-z]/){
         $_ =~ s/([^a-z])\Q$value\E([^a-z])/ $value /g;
      }
      else {
         $_ =~ s/\Q$value\E/ $value /g;
      };
   };

but that is obviously not pretty, and I'd like to do it as elegantly as
possible (preferably along the lines of the one line foreach up toward the
top).

Any ideas?


-Bink.


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

Date: Wed, 04 Mar 1998 23:16:18 -0600
From: Zena_Goddess_Of_Fire@mindless.com (Mike Binkley)
Subject: Re: complex reg expression help
Message-Id: <Zena_Goddess_Of_Fire-0403982316180001@magmysmac.lfc.edu>

>    foreach $value (@reg){$_ =~ s/\W\Q$value\E\W/ $value /g};

Damn, I realized that I mistyped this.  It should be:
  
   foreach $value (@reg){$_ =~ s/\b\Q$value\E\b/ $value /g};

so it looks for word boundaries as opposed to the non-word characters. 
*This* is the code that doesn't work.  (incidentally, \W didn't work
either. )

-Bink.


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

Date: Thu, 05 Mar 1998 09:17:22 +0100
From: Koos Pol <koos_pol@nl.compuware.com>
Subject: Re: Displaying subdirectories and not filenames
Message-Id: <34FE5F92.BB8DCDE@nl.compuware.com>

Bob Maillet wrote:
> 
> I am currently using opendir but would only like the subdirectories to
> be displayed and not the files which are in the directory I am opening.
> Any ideas?
> 
> Bob

Watch the linewrapping by the newsreader.
Have fun.

#!/usr/local/bin/perl
##################### Copyright
#############################################
#                                                                           
#
# This program is Copyright 1998 by Koos
Pol.                                #
# This program is free software; you can redistribute it
and/or              #
# modify it under the terms of the GNU General Public
License                #
# as published by the Free Software Foundation; either version
2             #
# of the License, or (at your option) any later
version.                     #
#                                                                           
#
# This program is distributed in the hope that it will be
useful,            #
# but WITHOUT ANY WARRANTY; without even the implied warranty
of             #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
the              #
# GNU General Public License for more
details.                               #
#                                                                           
#
# If you do not have a copy of the GNU General Public License write
to       #
# the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge,               #
# MA 02139,
USA.                                                             #
##############################################################################

##############################################################################
#                                                                           
#
# Display a tree structure like the DOS tree
command                         #
#                                                                           
#
# Usage: perl tree.pl [source
[depth]]                                       #
#                                                                           
#
##############################################################################
my $tree;
my $prefix;
my $maxlevel;

$tree     = $ARGV[0];
$maxlevel = $ARGV[1];

if (! defined $tree) {$tree = '.'}
if ($tree =~ /\?/)    {die ("Usage: perl tree.pl [source [depth]]\n")}
if ($maxlevel !~ /d*/) {die ("Usage: perl tree.pl [source [depth]]\n")}
if ($maxlevel == 0) {$maxlevel = -1}

$prefix = '';
disptree ($tree,$prefix,$maxlevel);

sub disptree {
    
    my $tree;
    my $maxlevel;
    my $current_entry;
    my $next_entry;
    my $prefix ;
    my $more_dirs;
    my $dirh;
    my $skip_entry;
    
    $tree      = $_[0];
    $prefix    = $_[1];
    $maxlevel  = $_[2];

    if ($maxlevel == 0) {return}

    $tree =~ s|/*$|/|; # keep exactly one /
    
    # Read the target directory
    $dirh = 'DIRH'.$maxlevel; # create a unique dir handle
    (opendir ($dirh , $tree)) || (warn "Can't read $tree $!\n");

    # skip files until directory found
    $skip_entry = 1;
    while ($skip_entry) {
        $current_entry = readdir($dirh);
        if    (! defined ($current_entry)) {$skip_entry = 0} # End Of
Dir
        elsif ( ($current_entry ne '.') && ($current_entry ne '..') &&
(-d $tree.$current_entry))  {$skip_entry = 0;}
    }
    #
    # --- Now check the rest of the entries for directories
    #
    if (defined $current_entry) { # did we hit EOD (EndOfDir) ?
        $more_dirs = 1; # No, raise the 'more_dirs' flag 
        while ($more_dirs) {
            # skip files until directory found
            $skip_entry = 1;
            while ($skip_entry) {
                $next_entry = readdir ($dirh);
                if (-d $tree.$next_entry) { $skip_entry = 0 } ;
            }
            # process the current dir
            print ($prefix.'+ '.$current_entry."\n"); # print the
current directory
            if (defined $next_entry) { # is this the last dir ?   
                disptree ($tree.$current_entry , $prefix.'|   ' ,
$maxlevel-1); # no, prepend the 'history'
                $current_entry = $next_entry;
            } else {
                disptree ($tree.$current_entry , $prefix.'    ' ,
$maxlevel-1); # yes. print this entry plainly
                $more_dirs = 0;
            }
        }
    }
    closedir $dirh;
}


-- 
Koos Pol
----------------------------------------------------------------------
S.C. Pol                                           tel: +31 20 3116122
PC Systems Administrator                   email: Koos_Pol@bigfoot.com
Compuware Europe                 PGP public key available upon request

      A little inaccuracy sometimes saves tons of explanation.
                        -- H. H. Munroe


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

Date: Thu, 05 Mar 1998 06:00:37 GMT
From: oneilt@ucla.edu (Tom O'Neil)
Subject: Good Perl book
Message-Id: <6dlf6d$1r04@clnws01.we.highway1.com>

I've had  a fair amount of experience with Perl, but it was a couple
of years ago so I'm a little rusty.  I was wondering what a good Perl
(including CGI) book(s) might be for a good reference and reminder?

Tom O'Neil
oneilt@ucla.edu



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

Date: Thu, 05 Mar 1998 09:45:57 +0100
From: David Goldstein <starman@regio-info.de>
To: Tom O'Neil <oneilt@ucla.edu>
Subject: Re: Good Perl book
Message-Id: <34FE6645.174343F2@regio-info.de>

Tom,
  A very good book that I have been using is "Teach Yourself CGI
PRogramming with Perl 5." It is published by samsnet and has many good
CGI scripts.

    David


Tom O'Neil wrote:

> I've had  a fair amount of experience with Perl, but it was a couple
> of years ago so I'm a little rusty.  I was wondering what a good Perl
> (including CGI) book(s) might be for a good reference and reminder?
>
> Tom O'Neil
> oneilt@ucla.edu





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

Date: 5 Mar 1998 05:16:26 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Help with complex data structures.
Message-Id: <6dlcfa$jnt$1@client3.news.psi.net>

Diego Zamboni (zamboni@cs.purdue.edu) wrote on 1647 September 1993 in
<URL: news:fwg1kxygq5.fsf@narnia.cs.purdue.edu>:
++ eheft@dnaco.net writes:
++ > typedef struct {
++ >     char title[32];      // Title for a List of Items.
++ >     int  min;            // Minimum item
++ >     int  max;            // Maximum item
++ >     int  numItems;       // Number of items in items[]
++ >     int  *items;         // The list of Items.
++ > } trDATA, *tpDATA;
++ > 
++ > trDATA data[16];         // Allocate 16 lists of items.
++ > 
++ > Could some kind soul show how to set a similar data structure in perl?
++ > I've hashed out one but its seems really awkward to access say
++ > data[0].items[5] or do a comparison like if (data[0].min < data[1].min)
++ 
++ Read the perldsc and perllol man pages. In Perl, you would not "declare"
++ the data structure type, but simply fill it in, like in:
++ 
++ for($i=0; $i<10; $i++) {

   foreach $1 (0 .. 9) {

++   $data[$i]->{title}="This is title $i";
++   $data[$i]->{min}=$i-1;
++   $data[$i]->{max}=$i+2;
++   $data[$i]->{items}=(1, 2, 3, 4, 5);

That doesn't do what you think it does. It makes $data[$i]->{items}
equal to 5. You want:
      $data [$i] -> {items} = [1, 2, 3, 4, 5];


And you can write the entire thing as:

    @data = map {{title  =>  "This is title $_",
                  min    =>  $_ - 1,
                  max    =>  $_ + 2,
                  items  =>  [1, 2, 3, 4, 5]}} (0 .. 9);



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle 'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'


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

Date: 5 Mar 1998 06:22:42 GMT
From: "Collier Cheng" <blueshel@ms2.seeder.net>
Subject: Java & Perl  which run faster on Unix?
Message-Id: <01bd47ff$4de185e0$735d0da3@collier.tku.edu.tw>

Java and Perl ...........Which run faster on Unix?


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

Date: 05 Mar 1998 02:15:17 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Java & Perl  which run faster on Unix?
Message-Id: <yaypzjzu.fsf@news.concentric.net>

"Collier Cheng" <blueshel@ms2.seeder.net> writes:

> Java and Perl ...........Which run faster on Unix?

Well, I ran a benchmark.  Here are the results:

Java                                           | 
Perl                                           |
         at t=0 they are even


     Java                                      |
   Perl                                        |
         at t=1, Java is hot out of the gate


       Java                                    |
       Perl                                    |
         but Perl is a fighter at t=2!


             Java                              |                    
                    Perl                       |
         things look not so good for Java



                       Java                    |
                                    Perl       |
         it's all over but the shouting...



                           vJaa                |
                                               |Perl
         oh dear, Java crashed your newsreader

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
This is his brain on no sleep.  Any questions?


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

Date: Thu, 05 Mar 1998 07:41:46 GMT
From: martin.oakley@usa.net (Martin Oakley)
Subject: Re: Java & Perl  which run faster on Unix?
Message-Id: <34fe56cb.2144955@news.bne.aone.net.au>

"Collier Cheng" <blueshel@ms2.seeder.net> wrote:

>Java and Perl ...........Which run faster on Unix?

How fast is a piece of string?
or should that be - which came first? The apple or the orange?


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

Date: Wed, 04 Mar 1998 23:54:31 -0800
From: sottek <sottek@quiknet.com>
To: "Phivu C. Nguyen~" <pcnguyen@chnews.intel.com>
Subject: Re: Multidimensional Hashes
Message-Id: <34FE5A37.958AF401@quiknet.com>

I'll take a shot at this one.. it is quite
interesting!

First I changed the code a little so we can
concentrate on what is happening.
-------------------------------------------------
#! /usr/bin/perl -w

my $my_hash;
my %random_order = ('x2' => x2d,
                    'x3' => x3d,
                    'x4' => x4d,
                    'x1' => x1d);

my $what = "this is a scalar";
# preassign keys into the hash
$my_hash{x1} = "this is a scalar";
$my_hash{x2} = $what;
$my_hash{x3} = "2";
$my_hash{x4} = "2";

# create a new entry in the hash element
foreach (keys %random_order) {
 $my_hash{$_}{d} = $random_order{$_};
}

# check for valid entries
foreach $first_dim (sort keys %my_hash) {
  print "$first_dim : $my_hash{$first_dim}{d}\n";
}
-------------------------------------------------
BTW in this form it prints out
x1 : x2d
x2 : x2d
x3 : x4d
x4 : x4d

The thing that is causing this weird behavior is that
at first your hash is set to a scalar, then later
you change it to be a ref to another hash. I really
don't think that this SHOULD cause the behavior above,
but I think I know WHY (sort of)

>From what I remember about true hash tables they
aren't really a "key = value" but rather a
function(key) = value .  I think perl does hashes by
having a list of unique values and each key ref's a
value. More than 1 key could ref the same value to
save space.

Now, as I have it above %my_hash only has two values.
so either x1 or x2 will give you "this is a scalar".
 (I changed this from your code's "" to show that it is the value not
the existence that duplicates the output.) 
I would assume that the hash should set itself up efficiently like
this..

KEY  REF  VALUE
x1 \
    ----- "this is a scalar"
x2 /
x3 \
    ----- "2"
x4 /

The hash only actually has two "values" stored because
any more would just waste space.  If you changed x4
to map to "3" it would be smart enough to add a "3"
to its values and not change x3.
Here is the problem..for some reason the hash is not
smart enough to disconnect x1 and x2 when you change
x1's value from a scalar to a ref. That makes x2's
value change right along with it. Then you change
x2's value so x1's gets changed.  The same for x3&4. 

You can fiddle with the scalars above to see that if
all four are "linked" they will all affect each other
(like in your code) or you can do three and 1.

My conclusion is that this is a bug.  I can't seem to
find any benefit from having this behavior so at 
least it is unintuitive. I would like to hear what
others this about this.

-------------------------------------------------
Matt Sottek
Intel Systems Programmer


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

Date: Wed, 04 Mar 1998 23:12:03 -0500
From: Dan Boorstein <danboo@negia.net>
To: Brian Springstead <bspring@j51.com>
Subject: Re: Paragraph mode and $/ variable
Message-Id: <34FE2613.BF6104A3@negia.net>

Brian Springstead wrote:
> 
> Is it possible to set $/ = /^\s{2,}[A-Z]/;  Not just the value, but have
> that evaluated like a regular pattern match?

$/ is a literal string only; no regex's. this being the case you can
try to fake it, by undefining $/, reading the file in as one long
string (300k shouldn't be too bad), and splitting into pieces based on
whatever regex you want. maybe whenever a \n is followed by spaces?
something like:

#!/usr/bin/perl -w
undef $/;
my @paragraphs = split /\n\s+/, <DATA>;
for (0 .. $#paragraphs) {
  print "\$paragraphs[$_] => $paragraphs[$_]\n";
}
__END__
Paragraph 1.

Paragraph 2. Preceded by "\n\n".
  Paragraph 3. Preceded by "\n  ".
	Paragraph 4. Preceded by "\n\t".

cheers,

dan boorstein


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

Date: Thu, 5 Mar 1998 00:00:36 -0600
From: "Joshua Frank" <joshua@midwest.net>
Subject: Re: perl compiler?
Message-Id: <6dlf33$59n$1@usenet47.supernews.com>




Try this site.
http://language.perl.com/info/software.html




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

Date: Thu, 05 Mar 1998 09:16:26 +0100
From: Geert Roovers <etmgero@etm.ericsson.se>
Subject: Re: perl for win95?
Message-Id: <34FE5F5A.30F0@etm.ericsson.se>

brain Lorraine wrote:
> 
> n-e-one know where i can dload perl for win95?
> 
> --
> peace,
> brain
> www.gl.umbc.edu/~blorra1

Have you even *tried* www.perl.com? Go to "Download software", and
scroll down to "Alien ports"

Geert Roovers


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

Date: 05 Mar 1998 08:48:46 +0100
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: Re: Perl QRG(Perl Quick Reference Guide)
Message-Id: <wl31zwh1std.fsf@plume.nl.compuware.com>

Allen W Hutcheson <allen@glenturret.co.uk> writes:

> In response to my own question - I found one on @
> 
> http://www.perl.com/CPAN-local/authors/Johan_Vromans/

Try http://www.squirrel.nl/people/jvromans/perlref.html

------------------------------------------------------------------------------
Johan Vromans                                             jvromans@squirrel.nl
Squirrel Consultancy                                  Haarlem, the Netherlands
http://www.squirrel.nl                  http://www.squirrel.nl/people/jvromans
PGP Key 2048/4783B14D   KFP = 65 44 CA 66 B3 50 0B 34  CE 0E FB CA 2D 95 34 D0
------------------------ "Arms are made for hugging" -------------------------


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

Date: 05 Mar 1998 08:47:46 +0100
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: Re: Perl QRG(Quick Reference Guide)
Message-Id: <wl34t1d1sv1.fsf@plume.nl.compuware.com>

jack_h_ostroff@groton.pfizer.com (Jack Ostroff) writes:

> In article <34FC6C18.C1471B27@glenturret.co.uk>, Allen W Hutcheson <allen@glenturret.co.uk> writes:
> 
> I have a Perl Quick Reference Guide (postscript) with the following 
> author info:
> 
> ---------------------------- author info -----------------------------
> Johan Vromans                                     jvromans@squirrel.nl
> Squirrel Consultancy                          Haarlem, the Netherlands
> http://www.squirrel.nl                  http://www.xs4all.nl/~jvromans
> ----------------------------------------------------------------------
> 
> I just tried and failed to connect to that web site.  I don't remember
> where I got the original (www.perl.org?)

Both web sites should be functional. Please let me know if you have
problems connecting.

For more information about the reference guide, see 
http://www.squirrel.nl/people/jvromans/perlref.html

------------------------------------------------------------------------------
Johan Vromans                                             jvromans@squirrel.nl
Squirrel Consultancy                                  Haarlem, the Netherlands
http://www.squirrel.nl                  http://www.squirrel.nl/people/jvromans
PGP Key 2048/4783B14D   KFP = 65 44 CA 66 B3 50 0B 34  CE 0E FB CA 2D 95 34 D0
------------------------ "Arms are made for hugging" -------------------------


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

Date: Thu, 05 Mar 1998 06:11:31 GMT
From: James Ludlow <jdludlow@millcomm.com>
Subject: Re: PERL question
Message-Id: <34FDEEAB.4E57DF59@millcomm.com>

Salman wrote:
> 
> Hi...
>    I want my java applet to execute a PERL program on the browser by
> passing a parameter to it...
>    Can anybody help me how to execute the Perl file from an applet and how
> I can pass a string to the pl file??

Hi.
No offense, but I think you have it a little backwards.  This sounds a lot
like a Java question.  Perhaps a trip to DejaNews and a Java related newsgroup
would yield better results.

Now, I'm no Java guru (or programmer for that matter), but I'm pretty sure
that an applet can't call other programs.  This is for security reasons.  If
you do find a way to launch other programs from your applet, then you should
check the perl manpages and look for ARGV for more info on passing a string to
your perl script.

--
James Ludlow (jdludlow@millcomm.com)


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

Date: 5 Mar 1998 06:02:08 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Problems with Win32 Perl and network
Message-Id: <6dlf50$nv3@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <34FC8566.D7C83D61@geoplex.com>,
Paul Burriesci  <paul@geoplex.com> wrote:
>operations returned to normal. The people running stress tests using
>webget
>would return to find hung machines. I would appreciate enlightenment on
>what is going on here if anyone knows.

The perl in bindist04 has a bug in the socket handling that leads to
a handle leak everytime a socket is closed.  The bug is fixed in
perl 5.004_04, so if this matters to you sufficiently terribly, you
could build perl from source.

Not relevant to this group, but Win32 (or at least, NT) also seems to have
a serious bug in process scheduling.  Try running a hundred copies of
this program from a batch file and watch your machine become useless for
several minutes.

    #include <windows.h>
    #include <stdio.h>
    int main (void) { Sleep(1000)/*millisec*/; printf("*"); return 0 }


 - Sarathy.
   gsar@umich.edu


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

Date: 5 Mar 1998 07:31:02 GMT
From: bernhard@perm.geologie.uni-freiburg.de (Bernhard Ehrminger)
Subject: Q: efficient usage of package?
Message-Id: <6dlkbm$pn$1@n.ruf.uni-freiburg.de>


Hello,

I have enclosed a program which calls a
subroutine form a package. The subroutine test
modifies the contents of @x and @y as desired.
So far the program is fine.

I would like to know if this an efficient way
(and good coding style) to modify global variables
in subroutines belonging to packages?
Thank you for any recommendation.


regards Bernhard 


#####################################
# this is the test.pl program
#####################################

#!/bin/perl -w
$[=1;
$x[1]=0;
$x[2]=0;
$y[1]=0;
$y[2]=0;
use CPE_perl::test;

 CPE_perl::test->test(*x,*y);

print @x,"\n";
print @y,"\n";


#####################################
# this is the test.pm package
#####################################

package CPE_perl::test;
BEGIN { require 5.004; 	
	require Exporter;
	@ISA = qw(Exporter);
	@EXPORT      = qw(*x *y);
	$VERSION = 1.0;
    }

use vars @Export;
sub test     {
$[=1;
    my $callpack = caller;    
    my $pack = shift;
    $x[1]=1;
    $x[2]=2;
    $y[1]=3;
    $y[2]=4;
}
1;
  



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

Date: Thu, 05 Mar 1998 00:29:53 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Summing Up Array Values - How Do I?
Message-Id: <34FE3852.1B48323A@coos.dartmouth.edu>

Uri Guttman wrote:
> 
> let's go schwartzian on the newbie!
> 
> @yards = (2,3);
> $sum = 0 ;
> map { $sum += $_ } @yards ;

That's not schwartzian.  The Schwartzian Transform, to which I assume you are
referring, is like this:

@array = map {$_ = &undo_change} sort by_whatever map {$_ = &do_change} @array;

map in void context != schwartzian

-- 
 _ / '  _      /             rjk@coos.dartmouth.edu
( /)//)//)(//)/(                     chipmunk@m-net.arbornet.org
    /                                        http://www.ziplink.net/~rjk/
        It's funny 'cause it's true ... and vice versa.


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

Date: 05 Mar 1998 02:00:47 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: use @records[$index] or $records[$index] ??
Message-Id: <zpj5zko0.fsf@news.concentric.net>

mshavel@erols.com (Michael Shavel) writes:

> #input file into array with each element being a record
> while(<>)
> {
> #create array of records
> @records[$index] = split /"\n"/;
> $index++;
> }

I think you've gotten a bit ahead of yourself.  I'll give you the line
of code that fills an array with lines of text from the magic diamond
operator,  but you'll reeeealy want to get yourself a copy of
_Learning Perl_.

chomp(my @records = <>);  # that's it.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Thu, 05 Mar 1998 09:02:30 +0100
From: Geert Roovers <etmgero@etm.ericsson.se>
Subject: Re: What am I doing wrong?
Message-Id: <34FE5C16.52E9@etm.ericsson.se>

John Porter wrote:
> 
> Man, you're taking your chances, asking a FAQ in this newsgroup!
> 
> perlfaq5: I just want to increment the number in the
> file. How can I do this?
> 
> hth,
> John Porter

What can I say... I like to live on the edge ;o) 

Anyway, thanx everyone, it works now (the seek did it).

~Geert


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

Date: 05 Mar 1998 00:06:59 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: What I meant
Message-Id: <x767ltybd8.fsf@sysarch.com>

Brandon Blum <bblum@earthlink.net> writes:

> Sorry all, what I meant was making a form in perl or anything else so
> that it sends you an e-mail or something and when i run my perl script
> from ms dos no html works, please read the first question and continue
> from here!

use CGI.pm which you can test without a browser.

uri

-- 
Uri Guttman                     SYStems ARCHitecture and Software Engineering
uri@sysarch.com                                          Have Perl, Will Hack
http://www.sysarch.com                (781) 643-7504 x*2  FAX: (781) 643-2710
Try the Best Search Engine on the Net -------->  http://www.northernlight.com


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

Date: 5 Mar 1998 07:15:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: What I meant
Message-Id: <6dljeh$ar9$1@marina.cinenet.net>

Brandon Blum (bblum@earthlink.net) wrote:
: Sorry all, what I meant was making a form in perl or anything else so
                                                    ^^^^^^^^^^^^^^^^
Which is why it has, as Abigail said, nothing to do with Perl.  Your 
question is about CGI, or HTTP, or HTML, or Web servers, or something 
*other than* the specific programming language Perl.  Ask yourself:  
Would you have this same problem if you were writing the app in C++?  If 
the answer is 'yes', then your question doesn't belong on c.l.p.m.  It'd 
be like asking for directions to Las Vegas on a Porsche newsgroup; yes, 
you can go to Las Vegas in a Porsche, but going to Las Vegas is *not* a 
Porsche-related issue.

: that it sends you an e-mail or something and when i run my perl script
: from ms dos no html works, please read the first question and continue
: from here!
: Sorry for the confusion,

Hope you find help where it's available!

---------------------------------------------------------------------
   |   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, 05 Mar 1998 09:55:53 +0100
From: David Goldstein <starman@regio-info.de>
Subject: Re: What I meant
Message-Id: <34FE6899.57E0D4AC@regio-info.de>

Brandon,
  Although the question "may not" belong here, the solution to your problem
is to go to www.omnicron.com and download a program called OmniHTTPd.  This
is a server that you can set up on Win95 and test all of your perl programs.

    David






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

Date: Wed, 04 Mar 1998 22:52:26 -0600
From: shans@fusi0n.com
Subject: Win32::EventLog
Message-Id: <6dlb0v$r0s$1@nnrp1.dejanews.com>

Does anyone have any info on this module ... when I perlcdoc it I get no doc
found..

I am trying to determine how to do a nightly dump of the NT Event Logs to
text files, and then clear them for the next day as well..


thanks.

Shan Schaefer
shans@fusi0n.com

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


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

Date: Thu, 05 Mar 1998 16:38:04 +1100
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Win32::EventLog
Message-Id: <34FE484C.A384232C@spider.herston.uq.edu.au>

There's some rudimentary info in the .pm file.  CPAN lists the module as
being in alpha.  You might want to ask ActiveState if it's still being
maintained.  The version on CPAN is somewhat buggy, but there's a guy in
France who's done some work on it - check out
http://www.inforoute.cgs.fr/leberre1/perldoc.htm

I find the state of affairs less than confidence-inspiring.  Is this
module going to track changes in NT? (<sarcasm on> What! introduce
incompatibilities in server software?!! What kind of software company
would do that?...<sarcasm off>.)  So I use dumpel.exe from the NT
resource kit instead - *then* use perl to massage the output.

-- 
Jaime Metcher


shans@fusi0n.com wrote:
> 
> Does anyone have any info on this module ... when I perlcdoc it I get no doc
> found..
> 
> I am trying to determine how to do a nightly dump of the NT Event Logs to
> text files, and then clear them for the next day as well..
> 
> thanks.
> 
> Shan Schaefer
> shans@fusi0n.com
> 
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 5 Mar 1998 12:19:11 +0530
From: "gopinath" <kagopi@deshaw.com>
Subject: XS help sought; representing C structures
Message-Id: <6dlhtb$ro1$1@news1.deshaw.com>

I am presently wrapping up a C library with perl.

I have gone through perlxs, perlxstut and perlxsguts
man pages.

The example of getnetconfigent() in perlxs does not
show as to how the c structures are represented in perl.
How do we implement the above function in
the .xs file ?

any help is greatly appreciated.

thanks,
Gopinath
kagopi@deshaw.com




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

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

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