[8625] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2242 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 3 14:07:37 1998

Date: Fri, 3 Apr 98 11:01:13 -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           Fri, 3 Apr 1998     Volume: 8 Number: 2242

Today's topics:
    Re: [SOURCE] rot90: New and better MIME format <jdporter@min.net>
    Re: [SOURCE] rot90: New and better MIME format <mpslon01@morehead-st.edu>
        CGI: Sending an image (Pascal van Rossum)
        Checking saving Date for a file <shakeel@ti.com>
    Re: contexts: is there such a thing as array? <gary@rdss.com>
    Re: contexts: is there such a thing as array? (Jason Gloudon)
    Re: contexts: is there such a thing as array? <cmargoli@world.northgrum.com>
    Re: contexts: is there such a thing as array? <andrew@erlenstar.demon.co.uk>
    Re: contexts: is there such a thing as array? <andrew@erlenstar.demon.co.uk>
    Re: contexts: is there such a thing as array? <andrew@erlenstar.demon.co.uk>
    Re: contexts: is there such a thing as array? <jdf@pobox.com>
    Re: contexts: is there such a thing as array? <dboorstein@shopcfn.com>
    Re: contexts: is there such a thing as array? <merlyn@stonehenge.com>
        Database sorting problem <chefandy@culinary.com>
        File Renaming Problem (Please Help...) <dlortie@nt.com>
    Re: HELP !!! - Templates within Perl maurice@hevanet.com
    Re: how to count a list of comma sep. items <jdf@pobox.com>
        internationalisation of MacPerl (Helmut Thetmeyer)
    Re: Is there a "Newsgroup" for Newbies to Perl? smitty77@pacbell.net
    Re: Is there a "Newsgroup" for Newbies to Perl? smitty77@pacbell.net
    Re: Looking for ANY Suggestions on parsing this line!! (Colin Kuskie)
    Re: memory usage of DBM vs hashes <dboorstein@shopcfn.com>
        passing arrarys into and out of a sub (function) <sboss@kennesaw.edu>
    Re: passing arrarys into and out of a sub (function) (Earl Hood)
    Re: Perl Databases... <sandy@bbt.com>
        Perl-AIX Build (Should I be worried?) (Reilly Shea)
    Re: unpack vs. substr (was Re: Data Structure for Input (Jason Gloudon)
    Re: unpack vs. substr (was Re: Data Structure for Input (Jeffrey R. Drumm)
    Re: unpack vs. substr (was Re: Data Structure for Input <Clinton.Bodine@mci.com>
    Re: What to do about "regexp *+ operand could be empty" (Michael Schuerig)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 03 Apr 1998 16:40:54 GMT
From: John Porter <jdporter@min.net>
Subject: Re: [SOURCE] rot90: New and better MIME format
Message-Id: <35251288.1A98@min.net>

Kevin Reid wrote:
> 
> Well, here's "read90":
>[...]

too long!
try this:

for $l (<>) {
  chomp $l;
  for ( 0..length($l)-1 ) {
    $a[$_] .= substr($l,$_,1);
  }
}
print join("\n",@a);

John Porter


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

Date: Fri, 3 Apr 1998 13:21:06 -0500
From: MICHAEL PATRICK SLONE <mpslon01@morehead-st.edu>
Subject: Re: [SOURCE] rot90: New and better MIME format
Message-Id: <Pine.HPP.3.91.980403131305.22726C-100000@msuacad.morehead-st.edu>

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

------=_NextPart_000_0004_01BD5E9F.68E39C00
Content-Type: TEXT/X-ROT90; CHARSET=iso-8859-1
Content-ID: <Pine.HPP.3.91.980403131305.22726E@msuacad.morehead-st.edu>

O C > I s k m o f w t T c s p p p t v t i r t t <
n h >   i e e w o a h h o h o o o h e h n u h o <   m
  r > h n e s n r n e i o o p r p o r i c n e p < t o e 
3 i > a c p s   m t   s l u u t u s t n l       < a r h 
  s > v e s a i a   a     l l i l e i k u t b a < h f t   .
A t > e     g n t t c i t d a o a   c   d h o s < t     a e
p i >   e s e v s o t s h   r n c w a I e e t   <   s o   r   e
r a > d v e s e     i   i b   s e h l       t w < k e t e u   n
  n > e e n   n t g o a n e i   , o l s a l o e < n n   b t   o
1 s > c r d i t h e n   g   n o     . h   i m l < i i m   a   l
9 e > i y i n e a t   r   e   f l r   o w n   l < h l o d e   S
9 n > d o n   d t   t e t x c   i e   u a e t ? < t   t l f   
8   > e n g t     i o a h t e t k a D l y s o   <   g t u     l
, w > d e   h   I n o l a r r h e d o d         < I n o o l   e
  r >     m e       . l t e t e         t f t   <   i b w u   a
T o > t e e i     o   y   m a     t y   o r h   < , n     f   h
o t > h l   r     n       e i     e o     o e   < s n e p e   c
m e > a s                 l n     x u     m     < e u h o s - i
  : > t e                 y       t             < Y r t t u - M
------=_NextPart_000_0004_01BD5E9F.68E39C00--


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

Date: Fri, 3 Apr 1998 19:48:06 +0200
From: pvr@xs4all.nl (Pascal van Rossum)
Subject: CGI: Sending an image
Message-Id: <MPG.f8f3f417491a38d98968a@news.xs4all.nl>

Hi,

I am trying to run a cgi script by calling it as an IMG SRC,
this is because I cannot run it by using a SSI.

However, Netscape 3.x users see the javascript document.write
that I use to write the IMG SRC tag to the screen. 

So my question is, how on earth do I send a 1x1 transparent
gif file to the client so that the browser is satisfied
and won't put the javascript source on the screen.

I've tried by just using print "Content-type: image/gif\n\n"
as well as "Location: <filelocation>". Both options do
not work.

Thanks in advance.


Pascal van Rossum


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

Date: Fri, 03 Apr 1998 11:49:06 -0600
From: M Shakeel Qureshi <shakeel@ti.com>
Subject: Checking saving Date for a file
Message-Id: <35252112.5B209FE4@ti.com>

Hello Everyone,

Is there a way to check on which date a file was saved on a unix machine
by using PERL ?


Regards,
*Shakeel


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

Date: Fri, 03 Apr 1998 11:50:49 -0500
From: Gary Ebert <gary@rdss.com>
To: Spider Boardman <spider@Orb.Nashua.NH.US>
Subject: Re: contexts: is there such a thing as array?
Message-Id: <35251366.69A4CF8B@rdss.com>

Spider Boardman wrote:
> 
> Randal Schwartz wrote:
> > So, once again, there CANNOT BE A LIST IN A SCALAR
> > CONTEXT.  EVER.  WAKE UP AND SMELL THE COFFEE! :-)
> 
> Maybe.  If you can explain away this one:
> 
>         $a = @hash{'a','b','c','d'};
> 
> --
> Spider Boardman (at home)                       spider@Orb.Nashua.NH.US
> The management (my cats) made me say this.      http://www.wp.com/spider
> PGP public key fingerprint: 96 72 D2 C6 E0 92 32 89  F6 B2 C2 A0 1C AB
> 1F DC

Spider:

	Before you post a question to this group there is at least one thing that you
should do.  YOU SHOULD WRITE A TEST PROGRAM TO SEE IF YOUR QUESTION IS VALID. 
The second and third lines of your test program should be:
use strict;
use diagnostics;

I assume you know what the first line should be.

Before you post a question to anyone regarding perl there are at least three
people's names you should know. Not necessarily in this order.

1)	Larry Wall			(the father of perl and one of the authors of the red and blue
perl camel)
2)	Randal Schwartz 	(one of the authors of the red and blue perl camel)
3)	Tom Christiansen	(one of the authors of the blue perl camel)

All three are perl guru's and know more about perl than anyone else in the
world.  Before you challenge them on a subject I would suggest that you know
exactly what you are talking about.  I personally would not challenge ANYONE
without writing a test program especially one of them.

But who am I to judge?  Perhaps you enjoy making a fool of yourself  by asking
a question about a program that will not run.

BTW here is the test program I wrote b4 composing this e-mail


#####################		Line intentionally left blank as an exercise for the student
use strict;
use diagnostics;
use vars qw($a @hash);
my ($a);
my (@hash);
$a = @hash{'a','b','c','d'};

Here is the output I got:
Variable "%hash" is not imported at ./testMe line 7 (#1)
    
    (F) While "use strict" in effect, you referred to a global variable
    that you apparently thought was imported from another module, because
    something else of the same name (usually a subroutine) is exported
    by that module.  It usually means you put the wrong funny character
    on the front of your variable.
    
Global symbol "hash" requires explicit package name at ./testMe line 7 (#2)
    
    (F) You've said "use strict vars", which indicates that all variables
    must either be lexically scoped (using "my"), or explicitly qualified to
    say which package the global variable is in (using "::").
    
Execution of ./testMe aborted due to compilation errors (#3)
    
    (F) The final summary message when a Perl compilation fails.
    
Uncaught exception from user code:
        Execution of ./testMe aborted due to compilation errors.


Please stop wasting people's time by asking questions you have not even tried
to answer yourself!!!!


				Gary
-- 
Gary Ebert                                 Operations Administrator
Voice:     (301) 428-2115                  Mobile Datacom Corporation
Fax:       (301) 428-1004                  19540 Amaranth Drive
Pager:     (800) 777-4681   PIN: 3981842   Germantown, MD  20875-2126


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

Date: Fri, 03 Apr 1998 17:28:39 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: contexts: is there such a thing as array?
Message-Id: <slrn6ia6t8.ab5.jgloudon@manitoba.bbn.com>

Spider Boardman <spider@Orb.Nashua.NH.US> wrote:
>Randal Schwartz wrote:
>> So, once again, there CANNOT BE A LIST IN A SCALAR
>> CONTEXT.  EVER.  WAKE UP AND SMELL THE COFFEE! :-)
>
>Maybe.  If you can explain away this one:
>
>	$a = @hash{'a','b','c','d'};

What list ? That's a hash slice, which is the same thing as 

@array = @hash{'a','b','c','d'};
$ = @array;

Same thing for @array[@anotherarray].

But not:

$a = (1,2,3) , which is what people think is a list in scalar context.

-- 
Jason Gloudon


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

Date: Fri, 3 Apr 1998 17:09:31 GMT
From: Charles Margolin <cmargoli@world.northgrum.com>
Subject: Re: contexts: is there such a thing as array?
Message-Id: <352517CB.1472@world.northgrum.com>

Spider Boardman wrote:
> 
> Randal Schwartz wrote:
> > So, once again, there CANNOT BE A LIST IN A SCALAR
> > CONTEXT.  EVER.  WAKE UP AND SMELL THE COFFEE! :-)
> 
> Maybe.  If you can explain away this one:
> 
>         $a = @hash{'a','b','c','d'};
> 

We need a name for "it looks like a list but it's using the comma
operator", or maybe we need to say that a list is not that expression
with parens and commas -- a list is the result of using that expression
in a List Context.
-- 
Charles G. Margolin                   DSSD Internal Information Services
cmargoli@world.northgrum.com          Northrop Grumman Corp. 0624/23
margolin@acm.org                      Hawthorne, California 90250-3277


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

Date: 03 Apr 1998 18:23:49 +0100
From: Andrew Gierth <andrew@erlenstar.demon.co.uk>
Subject: Re: contexts: is there such a thing as array?
Message-Id: <87ra3ehl96.fsf@erlenstar.demon.co.uk>

>>>>> "Spider" == Spider Boardman <spider@Orb.Nashua.NH.US> writes:

 > Randal Schwartz wrote:
 >> So, once again, there CANNOT BE A LIST IN A SCALAR
 >> CONTEXT.  EVER.  WAKE UP AND SMELL THE COFFEE! :-)

 Spider> Maybe.  If you can explain away this one:

 Spider> 	$a = @hash{'a','b','c','d'};

Inside @hash{...} you have list context. (Unlike $hash{...})

-- 
Andrew.


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

Date: 03 Apr 1998 18:51:48 +0100
From: Andrew Gierth <andrew@erlenstar.demon.co.uk>
Subject: Re: contexts: is there such a thing as array?
Message-Id: <87iuoqhjyj.fsf@erlenstar.demon.co.uk>

>>>>> "Gary" == Gary Ebert <gary@rdss.com> writes:

 Gary> 	Before you post a question to this group there is at least one
 Gary> thing that you should do.  YOU SHOULD WRITE A TEST PROGRAM TO
 Gary> SEE IF YOUR QUESTION IS VALID.

Just make sure your test program is correct though :-)

Try it like this:

use strict;
use diagnostics;
my %hash = ( a => 1, b => 2, c => 3 );
my $a;

$a = @hash{'a','b','c'};

print $a;

-- 
Andrew.


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

Date: 03 Apr 1998 18:59:44 +0100
From: Andrew Gierth <andrew@erlenstar.demon.co.uk>
Subject: Re: contexts: is there such a thing as array?
Message-Id: <87d8eyhjlb.fsf@erlenstar.demon.co.uk>

>>>>> "Jason" == Jason Gloudon <jgloudon@manitoba.bbn.com> writes:

 >> $a = @hash{'a','b','c','d'};

 Jason> What list ? That's a hash slice, which is the same thing as 

 Jason> @array = @hash{'a','b','c','d'};
 Jason> $ = @array;

Not quite:

my %hash = (a=>1, b=>1, c=>1);
my $a = @hash["a","b","c"];
print $a

Output is: 1

my %hash = (a=>1, b=>1, c=>1);
my @a = @hash["a","b","c"];
my $a = @a;
print $a

Output is: 3

-- 
Andrew.


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

Date: 03 Apr 1998 13:16:06 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: contexts: is there such a thing as array?
Message-Id: <n2e2kbyx.fsf@mailhost.panix.com>

Gary Ebert <gary@rdss.com> writes:


> Before you post a question to this group there is at least one thing
> that you should do.  YOU SHOULD WRITE A TEST PROGRAM TO SEE IF YOUR
> QUESTION IS VALID.

This is true.

> use vars qw($a @hash);

You needn't use the vars pragma unless your variables appear only once
in the file.

> my ($a);
> my (@hash);
> $a = @hash{'a','b','c','d'};

Perhaps your diagnostic output would have been different if you'd
scoped the variable %hash rather than @hash.  The perl fragment

   @foo{'a', 'b', 'c'}

refers to the hash %foo, and not to the array @foo.  The following
works fine.
   
   #!/c/perl/bin/perl -w
   use strict;
   my %foo = map { $_ => "$_ element" } qw( a b c d );
   my $a = @foo{'a', 'b', 'c', 'd'};
   print "$a\n";

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


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

Date: Fri, 03 Apr 1998 13:29:42 -0500
From: Dan Boorstein <dboorstein@shopcfn.com>
Subject: Re: contexts: is there such a thing as array?
Message-Id: <35252A96.9A65BB5B@shopcfn.com>

Jason Gloudon wrote:
> 
> Spider Boardman <spider@Orb.Nashua.NH.US> wrote:
> >Randal Schwartz wrote:
> >> So, once again, there CANNOT BE A LIST IN A SCALAR
> >> CONTEXT.  EVER.  WAKE UP AND SMELL THE COFFEE! :-)
> >
> >Maybe.  If you can explain away this one:
> >
> >       $a = @hash{'a','b','c','d'};
> 
> What list ? That's a hash slice, which is the same thing as
> 
> @array = @hash{'a','b','c','d'};
> $ = @array;

i apologize if i have misread your statement, but those are not the
same. Spider's example of a hash slice does indeed return a list, the
last element of which is assigned to $a. in your example you create
an array (proper) then assign that to a scalar which ends up with the
number of elements in that array. see the following:

%hash = qw( a w b x c y d z );
$foo1 = @foo1 = @hash{'a','b','c','d'};
$foo2 = @hash{'a','b','c','d'};
print $foo1, "\n";
print $foo2, "\n";
__END__
yields:

4
z


-- 
# dan boorstein <dboorstein@shopcfn.com>
seek DATA,0,0;print scalar<DATA>,__END__
Just another Perl hacker,


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

Date: 03 Apr 1998 11:52:40 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: contexts: is there such a thing as array?
Message-Id: <8cwwd668lj.fsf@gadget.cscaper.com>

>>>>> "Spider" == Spider Boardman <spider@Orb.Nashua.NH.US> writes:

Spider> Randal Schwartz wrote:
>> So, once again, there CANNOT BE A LIST IN A SCALAR
>> CONTEXT.  EVER.  WAKE UP AND SMELL THE COFFEE! :-)

Spider> Maybe.  If you can explain away this one:

Spider> 	$a = @hash{'a','b','c','d'};

A slice in a scalar context, by definition, returns the last element
of that slice.  This falls out directly of the equivalent full-blown
form:

	$a = ($hash{a},$hash{b},$hash{c},$hash{d});

where we see our friend, the comma operator, happily chugging away in
this scalar context, returning $hash{d} after evaluating each of the
other three.

Thus, once again, THERE IS NOT A LIST VALUE IN A SCALAR CONTEXT.
EVER.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 150 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Fri, 03 Apr 1998 10:01:27 -0600
From: Andy Biegel <chefandy@culinary.com>
Subject: Database sorting problem
Message-Id: <352507D7.6C103686@culinary.com>

I have a flatfile database like such:

9|04-02-98|today|364604|today|NULL
10|04-01-98|yesterday|364603|yesterday|NULL
11|04-03-98|tomorrow|364605|tomorrow|NULL

I'm trying to sort the database by the fourth field in each record
(364604,364603,364605,...). Any suggestions how to do this? Thanks.

Andy Biegel
andy@culinary.com




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

Date: Fri, 03 Apr 1998 11:23:19 -0500
From: Daniel Lortie <dlortie@nt.com>
Subject: File Renaming Problem (Please Help...)
Message-Id: <35250CF7.D04BEC5D@nt.com>

Hi I am having trouble renaming a file and I have absolutely no idea
why.

Here is my code:
--- start
    foreach $file (@filestomove)
    {
      chomp;
      $name = basename($file);
      $destname = "$spooldir/$name";
      $tmpname = $destname;
      $tmpname =~ s/std/incomplete/g; #copy as incomplete before
renaming as std
      if (rename("$file","$tmpname") == 0) { print "ren1 failed: $!\n";
}
      if (rename("$tmpname","$destname") == 0) { print "ren2 failed:
$!\n"; }
      print "MOVING COMMAND: mv $file $destname\n";
    }
--- end

I am trying to move a file from one directory to another (with an
intermediate step which is necessary
because the final directory has a daemon which will pick up any files
matching *std*)

Here is the output I get when I run the code
--- start
ren1 failed: No such file or directory
ren2 failed: No such file or directory
MOVING COMMAND: mv
/nt/users/zcrks46c_1/firms/spool/tester/teak_FNR_b11ext_1d10_b11e_cf_failures_apr03_10_31.stdf

 /nt/users/zcrks46c_1/firms/spool/stdf/teak_FNR_b11ext_1d10_b11e_cf_failures_apr03_10_31.stdf

--- end

The problem is if I run the "MOVING COMMAND" manually there is no
problem.
If I rely on the "rename(src,dest) method it returns an error. Why Why
Why???????




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

Date: Fri, 03 Apr 1998 11:06:39 -0600
From: maurice@hevanet.com
Subject: Re: HELP !!! - Templates within Perl
Message-Id: <6g34uu$69g$1@nnrp1.dejanews.com>



> I'm looking for a way of using HTML templates within Perl CGI-scripts,
> so I can isolate HTML-code (for script-output) from the script-source.
> The problem is that the (html-)output contains some variables, which are
> used inside the script.
>
> Do you know how to do this (if there is any way of using templates
> within Perl) ?

  Check out YAWP:

  http://olympia2.adhost.com/~maurice/

  It was designed for this purpose and is very Perlish.

- Maurice

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


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

Date: 03 Apr 1998 12:56:31 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: how to count a list of comma sep. items
Message-Id: <ogyikcvk.fsf@mailhost.panix.com>

Randal Schwartz <merlyn@stonehenge.com> writes:

> >>>>> "Greg" == Greg Bacon <gbacon@cs.uah.edu> writes:
> Greg>     $count = scalar keys %hash;
> Greg>     $count = scalar values %hash;
> 
> These two work only because the two operators are special-cased to
> return number of items in a scalar context.  They could have instead
> invoked nethack.

   $ perl -e '%foo = (); print scalar keys %foo;'
   jdf-B died in The Dungeons of Doom on level 1.
   Killed by a kitten.

   $

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


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

Date: Fri, 03 Apr 1998 19:31:58 +0200
From: hthetmeyer@ifm.uni-kiel.REMOVE.de (Helmut Thetmeyer)
Subject: internationalisation of MacPerl
Message-Id: <hthetmeyer-0304981931580001@bonito.ifm.uni-kiel.de>

In the perllocale manpage the author recognises: 

> but also for English: it would be very naove to think that
> A-Za-z defines all the ``letters''.

Indeed, it would be very useful if a programme for text manipulation
processed a statement like $a = "\udnderung" as expected, i.e. change
"dnderung" in "Dnderung". Case conversion of 8-bit characters (umlauts,
accented characters etc.), however, does not work with MacPerl (5.1.9
r.4). The manpage refers to the locale system (a so called standard) as
solution to the 8-bit problem. The MacOS, however, does not support the
locale system, and on our Unix workstations (DEC OSF/1) there is no locale
system installed (yes, I could ask our admin to do this ...).

Is it possible to make functions like "\u", "\L", or "uc" work with non
ASCII characters on a Macintosh (no, I do not want to install Linux for
that purpose)? If not, are there any external functions available which
can use arbitrary conversion tables in expressions like "s/(\w+)/\u\L$1/g"
?

Thank you in advance, Helmut

BTW, would it be easier to cope with international text using Python?

-- 
Please remove ".REMOVE" from return address
PGP  finger:thetmeye@sally.ifm.uni-kiel.de


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

Date: 3 Apr 1998 08:32:40 -0800
From: smitty77@pacbell.net
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <6g32v8$7qu@co-op.newsguy.com>

In article <352426cb.77422537@news.mmc.org>, drummj@mail.mmc.org says...
>To the point: I've been following this group daily for a bit over a year
>now . . . and from what I've seen, I doubt your solution will make a
>lasting impression on the problem.
>
>The newbies may flock to the group, and some intermediate folks may hang
>out there for a while. The newbies may get the answers they're too, um,
>(unskilled? impatient? presumptive? Dare I say it: lazy?) to look up, and
>the intermediate folks will get a little lift from helping their fellow
>pilgrims . . . but they'll quickly get tired of answering the same
>questions over and over and over again. They'll stop learning from their
>experiences there. And finally, they'll get frustrated and start (rudely or
>politely, it doesn't seem to matter since it pisses off the newbies either
>way) referring those newbies to whatever serves for a FAQ for the
>c.l.p.help group.  Or they'll leave.
>
>And the newbies . . . well, with c.l.p.help becoming devoid of useful
>content, I suspect they'll be back here.  But maybe 'here' will be a
>different place by then, because all the gurus will have fled to the
>moderated group currently under discussion. I'll follow them, because I
>want to learn. The newbies won't, because moderation won't let them.
>
>Being a newbie will REALLY suck then . . . since a terse referral to the
>FAQs is better than a wrong answer, or no answer at all.

You raise some interesting and possibly valid arguments.  And I appreciate your
approach to discussing the situation rather than ignorantly lashing out like
others have.  Let's say you're completely accurate.  The worst thing that could
happen is that everyone comes back here and it's the same thing all over again. 
If the worse case scenario is that things stay the same, then what is there to
lose in giving it a shot?  I just don't understand all the apprehension since
there really is nothing to lose.

I, like you, consider myself an intermediate perl programmer.  Perl is only one
of many tools I use to do my job.  I was lucky enough to have an opportunity to
take a class to learn the basics, but since perl isn't really a mainstream
language, I doubt many people have the luxury of having a class readily
available to take.  So they have to learn through the books and docs available. 
I don't think everyone has the same learning abilites when it comes to learning
straight from books.  I also happen to have coworkers I can ask questions of
when I get stuck if I can't find my answer in any book or online doc (which is
where I've managed to always get an answer - I've never had to post a question
to this newsgroup...yet).  Not everyone has that luxury either.  I know that I
would check out a new newsgroup because I believe I would still learn some
things.  Even from someone else who is only an intermediate programmer.  If it
works, then I'm happy.  In Larry Wall's own words "there's more than one way to
do it".  I really don't think the new newsgroup would only become populated with
lost, ignorant puppies.  But that's just my opinion.

>Just curious, but how long have you been following this group? I'm
>wondering how you developed such a low opinion of James. He's a profligate
>poster of useful information, and hardly of the rude or pompous variety. 

I've been following the group for a couple months now.  I haven't bothereed to
develop any personal relationships with anyone - I just am not afraid to give
the ones on the pedestals a shot in the kneecap if it's warranted.  If I
misinterpreted anyone's agenda, they should take it up with me, and if I was
wrong, I'll admit it.  Again, I appreciate your response.

Regards,

Dave

>                           Jeffrey R. Drumm, Systems Integration Specialist
>                                  Maine Medical Center Information Services
>                                     420 Cumberland Ave, Portland, ME 04101
>                                                        drummj@mail.mmc.org
>"Broken? Hell no! Uniquely implemented." -me


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

Date: 3 Apr 1998 08:55:48 -0800
From: smitty77@pacbell.net
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <6g34ak$ah2@co-op.newsguy.com>

In article <fl_aggie-0304980949250001@aggie.coaps.fsu.edu>,
fl_aggie@thepentagon.com says...
>Since you find pouring thru an immense FAQ difficult, I present to you
>some code that got posted here. I'm not the author, may whichever diety
>you choose to worship bless that person. See the end of this post.

Thanks so much.  

>However, if it _is_ in the FAQ, it _is_ answered thoroughly. The FAQ
>answers are about as close to perfection as any answers on USENET. They've
>been looked at by tens of thousands of eyes, tested by G*d alone knows
>how many people, and they've STOOD THE TEST OF TIME.

I agree that the FAQ info is pretty good.

>+ I know you wouldn't put yourself into
>+ that category, and believe me, the novices would welcome your absense from the
>+ group nearly as much as you would welcome their absense from this group.
>
>Perhaps. Remember that hardass teacher you had in highschool, who 
>worked you hard? I bet you do. Do you remember the ones that spoonfed
>you? you don't? That's what I thought...

I pretty much figured your ego wouldn't allow to you get through this post
without getting silly.  The teachers I remember are the ones who helped me the
most.

>+ People
>+ who are knowledgable in perl will go to this other newsgroup to both help and
>+ ask questions.  What are you afraid of?  That you'll get bored without
>all these
>+ people to pick on?
>
>If I wanted to pick 'em, I'd find them. Simple, eh? I don't want to pick
>on 'em, I want them to understand HOW to find the answers for themselves.

>Maybe someday their news server will be down, they'll have a deadline to
>meet, and the only help they'll have is...some books, and the on-line
>documentation and the FAQ. And that's it.

And yet you and others do pick on them.  If you say "go look at the FAQ" and
they don't, then that's their problem.  If you say "go look at the FAQ you
ignorant piece of crap", then you have a problem.

 ...deleted more silly stuff...

>Except maybe the person's on a deadline. The _last_ place I'd turn to
>for help in those situations is USENET. You may not GET an answer in
>a TIMELY fashion. If at all.

Agreed.

Dave

>James
>


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

Date: 3 Apr 1998 08:12:40 -0800
From: colink@latticesemi.com (Colin Kuskie)
Subject: Re: Looking for ANY Suggestions on parsing this line!!
Message-Id: <6g31po$gm2@sarek.latticesemi.com>

A much easier approach would be to try any of the following:

1) read the perl FAQ list, available at:  YOUR COMPUTER
  (personally, I would read perlfaq4 and grep/find for
   Comma-separated files)

2) Try looking at CPAN:

Text::
::CSV          adpO  Manipulate comma-separated value strings     ALANCITT

This exercise took me about 90 seconds, although I am somewhat familiar
with the FAQ and the module list because I get to answer so many
questions from people who either aren't aware that it exists or don't
bother to take the time.

Good luck,
Colin Kuskie


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

Date: Fri, 03 Apr 1998 11:14:37 -0500
From: Dan Boorstein <dboorstein@shopcfn.com>
To: otis@populus.net
Subject: Re: memory usage of DBM vs hashes
Message-Id: <35250AED.A4A1CED7@shopcfn.com>

Otis Gospodnetic wrote:
> 
> Hello,
> 
[SNIP]
> 
> But when I run the script like this one below, I get perl to use up to 26 MB
> of RAM (more than I can afford)
> 
[SNIP]
> 
> Can anyone help me understand the mystery of such high RAM usage when using
> DBM files, as well as possible reasons for .dir and .pag files not being on
> the disk?
> 

'foreach $n (1 .. 50000)' is going to be very RAM intensive. it *does not*
step through each element as they're created. it first generates the 
entire list of 50,000 numbers which then get iterated over. a regular
'for ($n = 1; $n <= 50000; $n++)' will be better here. or maybe
'while(++$n <= 50000)'.


> #!/usr/local/bin/perl
> 
> use NDBM_File;
> 
> $dbToFetch = tie %ToFetch,  "NDBM_File", "ToFetch", O_RDWR|O_CREAT, 0640;
> 
> foreach $n (1 .. 50000) {
>     print "$n\n";
>     $dbToFetch{$n} = "jdshfjshdfj shdf jsdh fjsdh fjdhsfj shdjfhsd
> fjhsdfhsdjf hsjdfhsdjf sjdfh";
> }
> 
> sleep(10);
> 
> foreach $n (50000 .. 1) {
>     print "$n\n";
>     delete $dbToFetch{$n};
> }
> __END__

-- 
# dan boorstein <dboorstein@shopcfn.com>
seek DATA,0,0;print scalar<DATA>,__END__
Just another Perl hacker,


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

Date: Wed, 01 Apr 1998 09:49:47 -0500
From: Scott <sboss@kennesaw.edu>
Subject: passing arrarys into and out of a sub (function)
Message-Id: <3522540B.5D83@kennesaw.edu>

Hello,

	I have already checked my Camel book and Panther(?) book and I can not
find out how to pass arrays into and out of a sub.  I found in the
Panther(?) book on page 8-9 to pass in two arrarys goes like this:

AddArray (\@ArrrayOne, \@ArrayTwo);

the sub looks like this:

sub AddArray
{
	my ($aone, $atwo) = @_;
	....
}

How can I pass the arrarys out?  do I need to use the return command? 
if so, what is the syntax for the command on passing out arrarys?

Please respond via email since I do not have time to read through all
the c.l.p.misc group.

Thanks alot,
Scott Boss

email:  sboss@kennesaw.edu


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

Date: 3 Apr 1998 17:01:10 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: passing arrarys into and out of a sub (function)
Message-Id: <6g34kn$9h4@news.service.uci.edu>

In article <3522540B.5D83@kennesaw.edu>, Scott  <sboss@kennesaw.edu> wrote:
>	I have already checked my Camel book and Panther(?) book and I can not
>find out how to pass arrays into and out of a sub.  I found in the
>Panther(?) book on page 8-9 to pass in two arrarys goes like this:
>
>AddArray (\@ArrrayOne, \@ArrayTwo);
>
>the sub looks like this:
>
>sub AddArray
>{
>	my ($aone, $atwo) = @_;
>	....
>}
>
>How can I pass the arrarys out?  do I need to use the return command? 
>if so, what is the syntax for the command on passing out arrarys?

Since you are passing references to the arrays, changes made within
the subroutine will affect the arrays.  Example:

    $atwo->[0] = "hello"

has the effect of changing the first item in @ArrayTwo to "hello".

BTW, if you want the return value of a routine to return multiple
arrays, return references.  Example:

    sub some_func {
	my $aref1 = [ ];
	my $aref2 = [ ];

	# ...

	($aref1, $aref2);
    }


	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Fri, 03 Apr 1998 11:48:48 -0500
From: Sandy Cash <sandy@bbt.com>
Subject: Re: Perl Databases...
Message-Id: <352512F0.38EB88FB@bbt.com>

John Porter wrote:
> 
> Andrew F. Lee wrote:
> >
> > > Bill Lewis <Bill.Lewis@mci.com> wrote:
> > >
> > > > Then in the script I assign keys and values like such:
> > > >
> > > > %info = $key => $value;
> > >
> > > $info{$key} = $value;
> > >
> >
> > %info = ($key => $value);
> >
> > maybe it was a typo ....
> 
> Maybe, but it's still wrong.  With that assignment,
> %info will never have more than one key.
> 
> John Porter

Uhh...how do you mean?  If you mean that, if one initializes a hash with
the syntax above, %hash = ($key => $value); , the hash can never be
grown/changed to include additional key/value pairs, then you're quite
incorrect:

This code:

%hash = ('name' => 'sandy');
$hash{'address'} = 'here';
print("$hash{'name'} lives at $hash{'address'}\n");

produces this output:

sandy lives at here

In fact, the % = ( key => value ) syntax is by far the most readable and
easiest way to initialize a multikeyed hash at one time.

Or did I misunderstand your assertion?

-Sandy

--
Sandy Cash	Unix System Administrator
sandy@bbt.com	BroadBand Technologies
http://intra.bbt.com/~sandy/


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

Date: Fri, 03 Apr 1998 17:41:36 GMT
From: traveler@rust.net (Reilly Shea)
Subject: Perl-AIX Build (Should I be worried?)
Message-Id: <35251cfc.17508688@news.rust.net>

I just did a build of Perl 5.0044 on AIX 4.1.5 and got an error when I
ran "make test". I investigated a little further with the following
commands but it's still unclear to me if this is something I should be
concerned about. I also took a look at the io/fs.t script to see if it
would provide any insight (it didn't, probably because I didn't fully
understand the script). Any clues for the clueless would be
appreciated.
################
%./perl io/fs.t
(blah,blah,blah)
not ok 5
(blah,blah,blah)
################
%./perl harness

io/fs...............FAILED test 5
        Failed 1/26 tests, 96.15% okay
(blah,blah,blah)
Failed Test  Status Wstat Total Fail  Failed  List of failed
io/fs.t                      26    1   3.85%  5
Failed 1/153 test scripts, 99.35% okay. 1/4604 subtests failed, 99.98%
okay.
################

Thanks,	
Reilly Shea
Detroit, MI aka The Motor City


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

Date: Fri, 03 Apr 1998 16:30:42 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: unpack vs. substr (was Re: Data Structure for Input File)
Message-Id: <slrn6ia3gi.91s.jgloudon@manitoba.bbn.com>

Jeffrey R. Drumm <drummj@mail.mmc.org> wrote:
 .
 .
 .
>But there's still a significant speed issue.
>
>Let's try really comparing apples to apples. I always _assumed_ that unpack
>would be faster than substr, especially when fetching multiple segments from a
>scalar. Turns out that ain't the case at all:
>
>	  @arr = unpack "A10x8A6x20A6",$var
>	  ($aye,$bee,$see) = unpack "A10x8A6x20A6",$var

Are your strings null terminated or padded ? Makes a big difference, as substr
alone won't do the job.

-- 
Jason Gloudon


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

Date: Fri, 03 Apr 1998 17:48:18 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: unpack vs. substr (was Re: Data Structure for Input File)
Message-Id: <35251923.174547716@news.mmc.org>

On Fri, 03 Apr 1998 16:30:42 GMT, jgloudon@manitoba.bbn.com (Jason Gloudon)
wrote:

>Jeffrey R. Drumm <drummj@mail.mmc.org> wrote:
>.
>.
>.
>>But there's still a significant speed issue.
>>
>>Let's try really comparing apples to apples. I always _assumed_ that unpack
>>would be faster than substr, especially when fetching multiple segments from a
>>scalar. Turns out that ain't the case at all:
>>
>>	  @arr = unpack "A10x8A6x20A6",$var
>>	  ($aye,$bee,$see) = unpack "A10x8A6x20A6",$var
>
>Are your strings null terminated or padded ? Makes a big difference, as substr
>alone won't do the job.

The ones I've dealt with mostly are padded, but I see your point. Thanks for
bringing that up.

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Fri, 03 Apr 1998 18:46:54 GMT
From: Clinton Bodine <Clinton.Bodine@mci.com>
Subject: Re: unpack vs. substr (was Re: Data Structure for Input File)
Message-Id: <35252E69.C5EF09FE@mci.com>

Jeffrey R. Drumm wrote:

> 
> The ones I've dealt with mostly are padded, but I see your point. > Thanks for bringing that up.

Unfortunately, I don't.  Could someone quickly clue me in?

-- 
Clinton Bodine
Email: Clinton.Bodine@mci.com


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

Date: Fri, 3 Apr 1998 20:15:16 +0200
From: schuerig@acm.org (Michael Schuerig)
Subject: Re: What to do about "regexp *+ operand could be empty"?
Message-Id: <1d6vj5f.1l5pyk21eku9hcN@rhrz-isdn3-p26.rhrz.uni-bonn.de>


Thanks to those who responded. Sigh, one day I'll find the time to read
_Mastering Regular Expressions_, I promise.

Michael


Gareth Rees <garethr@cre.canon.co.uk> wrote:

> Michael Schuerig <schuerig@acm.org> wrote:
> > I'm using a snippet from Tom Christiansen's striphtml to (rough and
> > ready) replace HTML markup with whitespace.
> > 
> >     $text =~ s{<(?:[^>'"]*|".*?"|'.*?')+>}{ }ogsx;
> > 
> > It worked once upon a time (around Perl 5.002(?), I think), but now I'm
> > getting this error message:
> > 
> >     regexp *+ operand could be empty.
> 
> The parenthesis in your regular expression, namely
> 
>   (?:[^>'"]*|".*?"|'.*?')
> 
> matches the empty string (since [^>'"]* matches the empty string).  You
> are then asking Perl to match one or more copies of the empty string,
> which makes no sense.
> 
> Either rewrite your regexp so it doesn't match the empty string, 
> 
>   <(?:[^>'"]+|".*?"|'.*?')+>
> 
> or if you insist on recognising <> as an HTML tag, try
> 
>   <(?:[^>'"]+|".*?"|'.*?')*>


-- 
Michael Schuerig
mailto:schuerig@acm.org
http://www.uni-bonn.de/~uzs90z/


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

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

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