[11265] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4865 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 10 17:07:25 1999

Date: Wed, 10 Feb 99 14:00:21 -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           Wed, 10 Feb 1999     Volume: 8 Number: 4865

Today's topics:
        "control-c" kills fork and script (I don't want this) <bruce.hartley@tivoli.com>
        @INC and dos path names <greg2@surfaid.org>
    Re: Big pbm with perl5.00502 solaris "package" (David Combs)
    Re: change column of nmbers to 2 dim array (Larry Rosler)
    Re: change column of nmbers to 2 dim array (Randal L. Schwartz)
    Re: change column of nmbers to 2 dim array <jglascoe@giss.nasa.gov>
    Re: DBI <greg2@surfaid.org>
        Extracting two bytes in hex out of an image file (Michael Shavel)
        flock not working properly! HELP! (Ryan McGuigan)
    Re: Frustrating problem with Exporter <tomw@action.cnchost.com>
    Re: fun with strings... (Bart Lateur)
        gethostbyaddr <graham@dotdot.force9.co.uk>
    Re: Help extracting Internet Address with Regular Expre droby@copyright.com
        How do I delete a hash element ?? paulosa@gcm.com
    Re: list comparison code? <jglascoe@giss.nasa.gov>
    Re: Newbie: Help to convert korn script (Jim Hutchison)
    Re: performance penalty: bareword, single quoting, doub (Martien Verbruggen)
    Re: Perl 'zine (brian d foy)
        Perl and Microsoft Mail <fuzzy825@hotmail.com>
    Re: perl floating points [benchmarking] (Ilya Zakharevich)
    Re: perl floating points [benchmarking] droby@copyright.com
        pod2latex or Pod::Latex - Anyone working on it? <jacklam@math.uio.no>
    Re: Python vs. Perl vs. tcl ? <garry@sage.att.com>
    Re: Python vs. Perl vs. tcl ? <arcege@shore.net>
    Re: Python vs. Perl vs. tcl ? (Ilya Zakharevich)
        SQL Pass-thru query with Win32::ODBC? <darreld@his.com>
    Re: strict (Martien Verbruggen)
    Re: system call works in command line mode but not from (Sameer Siruguri)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 10 Feb 1999 15:39:51 -0600
From: Bruce Hartley - TPS Consultant <bruce.hartley@tivoli.com>
Subject: "control-c" kills fork and script (I don't want this)
Message-Id: <36C1FCA6.627DD1B0@tivoli.com>

I have commands coming back with pages of data I am forking a process
and piping the data to "more -c". The operators want to press ctrl-c
when they have seen enough and the ctrl-c kills the fork and the script.

I have traps in place, but the script still gets killed. Does anyone
have any hints as to how I can get around this (besides writting on
there hands not to push ctrl-c and use "q" instead)

thanks,

Bruce





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

Date: Wed, 10 Feb 1999 21:00:40 +0000
From: Greg Griffiths <greg2@surfaid.org>
Subject: @INC and dos path names
Message-Id: <36C1F378.5614B819@surfaid.org>

I have all my PERL stuff installed in C:\PERL5\ etc, but have recently
added some new modules (ODBC.pm and CGI.pm), when running scripts using
these, I have to use the -I parameter on the PERL.EXE file, which is not
a good idea whne the section goes live, any idea what the problem is and
how to fix it. All other stuff works fine.


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

Date: Wed, 10 Feb 1999 20:36:30 GMT
From: dkcombs@netcom.com (David Combs)
Subject: Re: Big pbm with perl5.00502 solaris "package"
Message-Id: <dkcombsF6yH8u.LIM@netcom.com>

In article <79slqk$4hu$3@news0-alterdial.uu.net>,
Greg Ward <gward@cnri.reston.va.us> wrote:
>David Combs <dkcombs@netcom.com> wrote:
>> Although have been happily writing useful programs with perl5.004,
>> am having problems with perl5.00502, as just downloaded as a solaris 2.5.1 
>>   already-compiled "package" from www.sunfreeware.com, via the file 
>>   "perl-5.005_02-sol25-sparc-local.gz", which I gunzipped and then
>>   (solaris) "pkgadd'ed".
>[...]
>> use strict;
>> use diagnostics;
>> print "hello\n";
>[...]
>> /david3/packages/LWperl/bin/perl5.00502 -I/david3/packages/LWperl/lib/perl5/5.00502/ -w ~/hello.pl
>> couldn't find diagnostic data in
>> /usr/local/lib/perl5/5.00502/pod/perldiag.pod
>> /david3/packages/LWperl/lib/perl5/5.00502//sun4-solaris
>> /david3/packages/LWperl/lib/perl5/5.00502/
>> /usr/local/lib/perl5/5.00502/sun4-solaris /usr/local/lib/perl5/5.00502
>> /usr/local/lib/perl5/site_perl/5.005/sun4-solaris
>> /usr/local/lib/perl5/site_perl/5.005 . /home/dkc/hello.pl at
>> /david3/packages/LWperl/lib/perl5/5.00502//diagnostics.pm line 229,
>> <POD_DIAG> chunk 533.
>> 
>> BEGIN failed--compilation aborted at /home/dkc/hello.pl line 2, <POD_DIAG> chunk 533.
>
>Gee, I hope that quoting and eliding isn't too confusing.  I think I've
>reduced your problem to its bare essentials.
>
>In a nutshell, your Perl is mis-installed.  The fact that you're giving
>an explicit path to the Perl binary, *and* an explicit -I so Perl can
>find its library (I assume -- what happens if you leave off the -I?),
>looks very strange.
>
>Where does the Solaris Perl 5.00502 package get installed?  My guess,
>from the error message you got when using 'use diagnostics', is that
>it's in /usr/local, the default for most Unix systems.  But it appears
>that it's library is *not* in /usr/local/lib/perl5, which is the cause
>of your problems: your Perl binary has /usr/local/lib/perl5 hardcoded
>in, but it can't find its library there.  You *must* put the Perl
>library where the binary expects to find it, or you will lose bigtime!
>
>BTW, the reason that 'use diagnostics' is failing is because it pokes
>around the library directory looking for a file called perldiag.pod.  If
>it can't find it ... boom!
>
>        Greg
>-- 
>Greg Ward - software developer                    gward@cnri.reston.va.us
>Corporation for National Research Initiatives    
>1895 Preston White Drive                      voice: +1-703-620-8990 x287
>Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913




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

Date: Wed, 10 Feb 1999 12:25:23 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: change column of nmbers to 2 dim array
Message-Id: <MPG.112b8b0a439690cd989a14@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <Pine.GSO.3.96.990210135517.20443E-100000@crusoe.crusoe.net> 
on Wed, 10 Feb 1999 14:01:28 -0500, evil Japh <jeffp@crusoe.net> says...
> > How can I use perl to transform a column of numbers (2592) to a 2
> > dimensional
> > array  (36 x 72) using say an embedded loop and print out results?
 ...
> If you want a 3x4 array, do you want it to look like this?
> [A,B,C],
> [D,E,F],
> [G,H,I],
> [J,K,L]
 ... 
> my ($x,$y);
> for (@numbers){
> 	$array[$x][$y++] = $_;
> 	($x++ and $y = 0) if $y == 2;
> }
> 
> 
> A quick explanation may be in order.  $x and $y are 0 to begin with.  For
> each element in @numbers, $array[$x][$y++] is assigned that element.  $y
> is incremented after that is done.  Then, if $y == 2 (or possibly 36 in
> your case), $x is incremented, and $y is set back to 0.
> 
> Hope this is useful.

It would be much more useful if it were correct (and tested).

>  	($x++ and $y = 0) if $y == 2;

The 'and' means that $y doesn't get reset when $x is 0 (the first row of 
the output array).  Therefore, it never gets reset at all, because $y 
will never be 2 again, and $x will always be 1 thereafter.

If you want to write it that way, a comma is better, because it doesn't 
introduce an extraneous and incorrect test.

The '2' means that the output array will have only two elements per row, 
not three as shown in your example.  So:

  	($x++, $y = 0) if $y == 3;

Needless to say, There Are Many More Ways To Do It, but any of them that 
is published here should be correct (and tested).

> --
> Jeff Pinyan (jeffp@crusoe.net)

Please put a space ater the two dashes to conform to Usenet standards, 
so the newsreaders won't include your .sig in responses. 

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


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

Date: 10 Feb 1999 12:52:12 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: change column of nmbers to 2 dim array
Message-Id: <m1iudakmmb.fsf@halfdome.holdit.com>

>>>>> "Dale" == Dale Bess <t.d.bess@larc.nasa.gov> writes:

Dale> How can I use perl to transform a column of numbers (2592) to a 2
Dale> dimensional
Dale> array  (36 x 72) using say an embedded loop and print out results?

@original = (1..2592);

push @new, [splice @original, 0, 36] while @original;

print "Just another Perl hacker,"

-- 
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: Wed, 10 Feb 1999 16:24:57 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: "Randal L. Schwartz" <merlyn@stonehenge.com>
Subject: Re: change column of nmbers to 2 dim array
Message-Id: <36C1F929.7C729256@giss.nasa.gov>

"Randal L. Schwartz" wrote:
> 
> push @new, [splice @original, 0, 36] while @original;

huh...

map { [map { shift @original } (1..72)] } (1..36)


	Jay Glascoe
-- 
http://www.giss.nasa.gov/cgi-bin/csci/change.pl


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

Date: Wed, 10 Feb 1999 20:58:01 +0000
From: Greg Griffiths <greg2@surfaid.org>
To: Nathan Feger <nathan@pentrel.com>
Subject: Re: DBI
Message-Id: <36C1F2D9.E255F4A2@surfaid.org>

http://www.hermetica.com/technologia/DBI/index.html

Nathan Feger wrote:
> 
> hi,
> 
> Where can I find a descent bit of information on DBI.  I cannot seem to
> find a good listing of the capabilities of what is possible with DBI,
> the site where you download it doesn't have a good reference.
> 
> Perhaps someone could point me to another.
> 
> thanks
> 
> -nathan
> 
> --
> Nathan Feger                    e-mail:nathan@pentrel.com
> Pentrel Internet                whois NF1024
> http://www.pentrel.com          phone: 877.pentrel


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

Date: Wed, 10 Feb 1999 14:58:28 -0400
From: mshavel@erols.com (Michael Shavel)
Subject: Extracting two bytes in hex out of an image file
Message-Id: <mshavel-1002991458280001@130.9.16.207>

Hi

I am trying to extract some data from within an image file (JPEG) and am
having some problems. Here is the story ..
There is some caption info in each image file I am looking at. I know the
caption info starts at  this maker -> 1C0278.  Now, the next two bytes in
the image file tell me how LONG the caption will be  [bytes] -- (Caption
sizes vary so none will necessarily the same). I need to find out what
these two bytes are , save that information into a variable and use it as
my $caption_end variable so I know when to tell substr to stop reading. 
I know these two bytes are right after what is held in $caption_return but
I can't get their values into a variable. Whenever I run this is just
pauses when it trys to write out  $caption_length.

Any help/suggestions as always are very much appreciated.

Thanks

Mike Shavel
mshavel@erols.com


#!/usr/bin/perl -w

$caption_begin = "\x1C\x02\x78";  #I know this is where the caption starts

@files = <"dcozvhaa.jpg">;  #open the test file

foreach $file (@files){
        open (FILE, "<$file");
        @lines = <FILE>;
                foreach $line (@lines){
        $fullstring .= $line   #get the whole file into one string
                }
#caption_return is in decimal!
$caption_return = index $fullstring, $caption_begin;
$hex_cap_return = sprintf("%lx",$caption_return);

read FILE, $caption_length, 2,$hex_cap_return;

#caption holds the  text caption. I need to know what $caption_end will be.
#$caption = substr $fullstring, $caption_return+5, $caption_end;

print "This is value in return DEC $caption_return\n";
print "This is the value in HEX $hex_cap_return\n";

print "This is value in caption length is:  $caption_length\n";

#print "This is the caption: $caption\n";


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

Date: Wed, 10 Feb 1999 20:33:04 GMT
From: ryan@mail.ramresearch.com (Ryan McGuigan)
Subject: flock not working properly! HELP!
Message-Id: <42mw2.293$%B4.282280@news.abs.net>

Hi, I got a big problem, for some reason flock isn't working properly.

here what I have in my locking subrouting,

unless (flock ($db_fh, 2 | 4)) {
  warn "Waiting for lock ($!) ....\n";
  for ($i = 0; $i < 1000; $i ++ ) {
    if (flock ($db_fh, 2 | 4)) {
      sleep(1);
      last;
    }
    warn "$!\n"
  }
}

This seems to work ok when there are like 2 processes that run at the same
time, but if I run around 5 to 20 processes, it somehow doesn't work.
This is a severe problem, it doesn't just lose data, because of the way I
manipulate the file it gets completely whacked.

BTW, the 2 and the 4 are correct on my system (Linux 2.0.35, Perl
5.004_04), I checked to be sure.  I have tried all the examples give in
the camel book, perldocs etc etc etc...  NOTHING will make it work right.
If anyone has ANY thing they can offer it would be much appreciated.

thanks
Ryan


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

Date: Wed, 10 Feb 1999 14:33:37 -0700
From: Tom Williamson <tomw@action.cnchost.com>
To: Greg Ward <gward@cnri.reston.va.us>
Subject: Re: Frustrating problem with Exporter
Message-Id: <36C1FB31.C30E51AC@action.cnchost.com>

Greg -

Many thanks.  I am still struggling with this; I have spent most of the
morning wrestling with the documentation trying to extract additional
information on the Exporter module.  It now seems fairly straightforward, I
just can't get it to work!   I am now taking additional code straight out of
the Perl documentation (this came from perlfaq7.html)  and attempting to get
it working:

Exporting module:

    package mystuff::myglobal;
    use strict;
    BEGIN {
        use Exporter   ();
        use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
        @ISA         = qw(Exporter);
        @EXPORT      = qw( $thing1 );
       @EXPORT_OK = qw( $thing1 );
    }
    use vars      @EXPORT_OK;
    use vars      @EXPORT;
    use vars      qw(  $thing1 );
    $thing1  = 'this is my thing1';

Importing routine:

   use strict;
   use mymodules::myglobal;
   use vars qw( $thing1  );
   print "\n".$thing1."\n";

This (the Importing routine) fails with "Use of uninitialized value" when it
gets to the print statement.

Everything I have read tells me this should work and that Perl should
cheerfully translate $main::thing1 to $mystuff::myglobal::thing1.  Yet this
is not happening.   If I comment out the "use vars qw($thing1)" line  I get
"Global symbol $thing1 requires explicit package name" instead.

Somehow, Exporter is not functioning.  There is probably one line missing or
one line extra somewhere in this code, but since I've never seen this module
work, I don't know what to look for.   ANY suggestions, sample code,
sympathy, etc.  are very much appreciated.

BTW:  Re Python, I'd love to change but I didn't pick Perl, the choice was
made when I got here.  My personal choice would have been Java or C++.

BTW#2:  Re comp.lang.perl, I'm not very coherent at 4AM - at least my fingers
aren't.  :)

Thanks again -

Tom


Greg Ward wrote:

> Tom Williamson <tomw@action.cnchost.com> wrote:
> > The export script looks like:
>
> The standard terminology would be to call this an "exporting module",
> but that's picking nits.
>
> > use Exporter;
> > @ISA = qw(Exporter);  ##This is never explained, but it's in all the
> > examples
> > $MYSYM1 = "BLA BLA BLA";
> > $MYSYM2 = "I HATE PERL";
> > @EXPORT = qw( MYSYM1 MYSYM2 );
>
> If the symbols you're trying to export are scalar variables, then you
> need the dollar sign:
>
>    @EXPORT = qw($MYSYM1 $MYSYM2);
>
> I don't recall ever seeing this mentioned in the Exporter documentation
> -- I guess you're just supposed to figure it out on your own.  ;-)
>
> BTW #1: that documentation you quoted in your second post is not
> ActiveState's, it's Perl's.  Nice of them to repackage it for the
> Windows folks, but that's the standard Perl documentation!
>
> BTW #2: if you don't like Perl, try Python.  Among other nice features,
> it has a very clear and simple import mechanism.  (Err, most of the
> time... various people are trying to complicate it, but for now it's
> still quite clear and simple.)  See http://www.python.org/.
>
> BTW #3: there is no such newsgroup as comp.lang.perl.
>
>         Greg
> --
> Greg Ward - software developer                    gward@cnri.reston.va.us
> Corporation for National Research Initiatives
> 1895 Preston White Drive                      voice: +1-703-620-8990 x287
> Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913



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

Date: Wed, 10 Feb 1999 19:58:44 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: fun with strings...
Message-Id: <36c2e087.830520@news.skynet.be>

alves@sparky.webmetro.com () wrote:

>: :s/(\\[nt])/"\"$1\""/gee;
>
>
>: Can't resist:  gee that's cool.
>
>Thanks for all the replies!  And yes, gee that is cool.

Shouldn't that be: "gee, that's slow"? After all, the double e indicates
an eval() on a string, which is usually frowned upon, mainly for speed
reasons.

This calls for a benchmark! Where are the volunteers!

	Bart.


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

Date: Wed, 10 Feb 1999 21:44:55 -0000
From: "Graham Wharton" <graham@dotdot.force9.co.uk>
Subject: gethostbyaddr
Message-Id: <Agnw2.3334$1l1.339@wards>

I've been trying to write a perl script to convert a host address into a
host name.
I know you do it with gethostbyaddr but i don't know how
Can anyone help

Thankyou
--
Graham Wharton

graham@dotdot.force9.co.uk
===========================
Web Site and Discussion Board at
http://www.dotdot.force9.co.uk
===========================





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

Date: Wed, 10 Feb 1999 20:50:39 GMT
From: droby@copyright.com
Subject: Re: Help extracting Internet Address with Regular Expression.
Message-Id: <79srep$76s$1@nnrp1.dejanews.com>

In article <OxwpUrPV#GA.248@upnetnews02.moswest.msn.net>,
  "Nelson Beaman" <nbeaman@msn.com> wrote:
> I am trying to extract an Internet address (i.e. beaman@hboi.edu) from a
> string by using pattern matching - with little success.  I know someone has
> figured this out.  Please help!
>
> ntb
> Beaman@hboi.edu
>
>

Have you read the section of perlfaq9 under the heading

	How do I check a valid mail address?

--
Don Roby

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 10 Feb 1999 21:43:53 GMT
From: paulosa@gcm.com
Subject: How do I delete a hash element ??
Message-Id: <79suim$acg$1@nnrp1.dejanews.com>

I tried "undef" does not work.

ex:

$hash{test} = "test";
undef $hash{test};

does not remove 'test' from the hash?? any ideas!

thanx

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 10 Feb 1999 15:15:29 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Monty Scroggins <Monty.Scroggins@mci.com>
Subject: Re: list comparison code?
Message-Id: <36C1E8E0.923ED03F@giss.nasa.gov>

Monty Scroggins wrote:
> 
> Does anyone have a snippet of code that would perform the
> equivilent of the unix "comm" command?   I would like to
> compare two lists (A and B) and generate three output lists
> 
> a list of lines in A and not B,
> a list of lines in B and not in A,
> a list of lines in both A and B.

okay

---------------------------
use strict;
use vars qw(@A @B @C);

@A = qw(one 2 shoe blue boo 0);
@B = qw(two 1 \#00ff00 shoe);
@C = qw(1 2 3 4 3 2 1 one two three two one 0);

sub list_intersect
{
        my ($A_aref, $B_aref) = @_;
        [ grep { defined $_ }
               map { $a=$_; if (grep { $_ eq $a } @$B_aref) { $a } else { undef } }
                   @$A_aref
        ];
}

sub list_subtract
{
        my ($A_aref, $B_aref) = @_;
        [ grep { defined $_ }
               map { $a=$_; if (grep { $_ eq $a } @$B_aref) { undef } else { $a } }
                   @$A_aref
        ];
}

sub list_add
{
        my ($A_aref, $B_aref) = @_;
        [ @{ list_subtract($A_aref, $B_aref); },
          @{ list_subtract($B_aref, $A_aref); },
          @{ list_intersect($A_aref, $B_aref); },
        ];
}

sub list_unique
{
        my ($aref) = @_;
        my %hash;
        map { $hash{$_} = undef } @$aref;
        return [ keys %hash ];
}

sub list_pretty_print
{
        print "'", join "','", @{ shift() };
        print "'\n";
}

sub main
{
        list_pretty_print(list_intersect(\@A, \@B));
        list_pretty_print(list_subtract(\@A, \@B));
        list_pretty_print(list_subtract(\@B, \@A));
        list_pretty_print(list_add(\@B, \@A));
	list_pretty_print(list_unique(\@C));
}

main();
---------------------------

> 
> Thanks
> 
> Monty.Scroggins@mci.com

--
	"From each according to his abilities,
	 to each according to his needs."

	-- Karl Marx


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

Date: Wed, 10 Feb 1999 20:15:56 GMT
From: jimhutchison@metronet.ca (Jim Hutchison)
Subject: Re: Newbie: Help to convert korn script
Message-Id: <36c1e747.190471012@news1.cal.metronet.ca>

That's OK...    btw, I can't send email to you.  

Can you make an addition to the script to get rid of the string  "//
(quote-slash-slash).  Some URLs in the log file, when doing a
"CONNECT" instead of a "GET" don't have the "http://" prefix.

I played with the script somewhat, but couldn't get it to strip
anything out.

Thanx....


On Tue, 09 Feb 1999 16:43:55 -0500, Jay Glascoe
<jglascoe@giss.nasa.gov> wrote:

>Jay Glascoe screwed up:
>> 
>>         # in main
>>         local *FH = open "< input_thingy" or die "can't open thingy: $!";
>
>hrmph.
>
>	local *FH;
>	open FH, "< input_thingy" or die "can't open thingy: $!";
>
>help-I'm-gettin'-my-Perlese-and-Pythonish-screwed-up!'ly y'rs,
>Jay
>
>BTW:
>you don't *really* need the "my" declarations,
>nor the "local *FH;" thing.  But without them
>all the variables are global...  icky.



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

Date: Wed, 10 Feb 1999 21:57:43 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: performance penalty: bareword, single quoting, double quoting
Message-Id: <rhnw2.611$Uh.7398@nswpull.telstra.net>

[My news server spool just got cleaned out, so I am not sure if this
has been mentioned in this thread already]

In article <1dmzjss.1nx89hnbffik4N@bay2-161.quincy.ziplink.net>,
	rjk@linguist.dartmouth.edu (Ronald J Kimball) writes:

>> In article <Pine.A41.4.02.9902081916590.13514-100000@ginger.libs.uga.edu>,
>> Brad Baxter  <bmb@ginger.libs.uga.edu> wrote:
>> >I like barewords in those places where perl doesn't complain about
>> >them. Actually, -w doesn't complain about lower-case barewords.

> Unfortunately, when Brad wrote the above statement in his message he
> left the context of the thread assumed rather than specified.
> 
> What Brad meant to say was:
> 
> I like barewords in those places where perl doesn't complain about
> them. Actually, -w doesn't complain about lower-case barewords **as hash
> keys**.
> 
> In other words, -w will not complain about things such as $x{foo}.

It only doesn't complain when the context is clear. If there is any
doubt, perl will complain:

# perl -w
sub foo { 3 };
$a{foo} = 2;
Ambiguous use of {foo} resolved to {"foo"} at - line 2.
$a{'foo'} = 3;
__END__

It is definitely safer to use quotes in hash keys, otherwise you'll
find yourself in the need at some time to go over your code and quote
all those occurrences of that new function name as a hash key.

Writing OO code in perl, with accessor functions that have the same
name as the member variables (hash keys of the blessed hash reference
that is the object) has taught me to just type in those extra quotes
:).

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | We are born naked, wet and hungry. Then
Commercial Dynamics Pty. Ltd.       | things get worse.
NSW, Australia                      | 


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

Date: Wed, 10 Feb 1999 15:18:53 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl 'zine
Message-Id: <comdog-ya02408000R1002991518530001@news.panix.com>

In article <36C1D025.8453E09D@ecpi.com>, webmaster@wondertek.com posted:

> If you already plan to go monthly as soon as possible, then maybe we could just help you
> out to meet our needs. Lord knows you already have publishers and paper suppliers and
> advertisers and all that lined up and that alone would probably take me a full quarter to
> line up assuming I did actually pull off the financial backing.

as i recall, Jon once said something about the frequency of a magazine
and it's usefulness varied inversely.  a monthly magazine meant for 
advertisers which meant less pages devoted to content.  of course,
Jon explained this much better, but i can't remember if it was a 
personal conversation or if i read it somewhere.

maybe this will prompt an eloquent reply :)

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: 10 Feb 1999 20:03:00 GMT
From: "Fuzzy" <fuzzy825@hotmail.com>
Subject: Perl and Microsoft Mail
Message-Id: <01be5530$2b0dfa00$cc34dea1@cbcgren091454>

Is it possible to use perl to send to Microsoft Mail (or Post Office or
whatever they call their mail product... Exchange etc etc etc)?

With attachments or am I just out in space somewhere?

Thanks
Fuzzy



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

Date: 10 Feb 1999 21:12:13 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: perl floating points [benchmarking]
Message-Id: <79ssnd$emp$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was NOT sent to Sitaram Chamarty
<sitaram@diac.com>],
who wrote in article <slrn7c3ch0.g4p.sitaram@diac.com>:
> Who would have thunk it?  Ilya *has* a sense of humour!  (Please
> Ilya - no offense intended!  I have seen a few posts where you
> responded very seriously to an obvious joke...)

Hmm, does anybody on this group has a sense of humour?  How do you
thihk are you *supposed* to respond to an obvious joke?!

Ilya


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

Date: Wed, 10 Feb 1999 21:09:31 GMT
From: droby@copyright.com
Subject: Re: perl floating points [benchmarking]
Message-Id: <79sshv$89p$1@nnrp1.dejanews.com>

In article <36C19900.C3EAC0A5@austin.ibm.com>,
  Tom Briles <tbriles@austin.ibm.com> wrote:
> Ilya Zakharevich wrote:
>
> > About your subject: Perl has only one floating point, and it is
> > allowed to float upwards only.  This point, though a scarce resource,
> > is very useful to implement the bubble sort algorithm, one which is
> > used when you do sort(@array) in Perl.
> >
> > In fact it is quite interesting to listen to these tiny bubbles
> > created when this point floats upward (you need to have a pretty big
> > @array for the sound to be above the ear threshold).  What I always
> > was interesting in is how the speed of sort algorithm depends on
> > having a desktop case vs. a tower case (with the same processor).  I
> > would think that bubbles may accelerate to much higher speed given a
> > tower case.
> >
> > Anybody ready for a benchmark?
> >
> > Ilya
>
> Actually, from my testing, it depends (as is generally the case with
> benchmarks).
>
> If a single array is being bubble sorted, the tower is much faster - but if
you
> code your program such that many arrays are sorted in parallel, the desktop
will
> win out.  EACH array sorted in parallel takes longer on the desktop, but the
> TOTAL time for all sorts is less.
>

But if you enable threads you can float more points.  Alot more if you have
enough CPUs in an SMP OS.  Best performance is with all these CPUs in a
mini-computer or even mainframe cabinet in an air-conditioned room with glass
walls.

And the sound is wonderful.  Just like Lawrence Welk.

--
Don Roby

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 10 Feb 1999 22:34:37 +0100
From: Peter John Acklam <jacklam@math.uio.no>
Subject: pod2latex or Pod::Latex - Anyone working on it?
Message-Id: <36C1FB6D.BCD9D76B@math.uio.no>

I realized that pod2latex was rather buggy and I started hacking it
to see if I could fix it.  I've fixed several problems, but I there
is not much point in me fixing it if someone else is already working
on it ... or perhaps even a Pod::Latex module.

So, is anyone working on pod2latex or Pod::Latex?

The previous author (Taro Kawagish) is apparently not, and his email
address is no longer valid.

Peter

-- 
Peter J. Acklam - jacklam@math.uio.no - http://www.math.uio.no/~jacklam


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

Date: Wed, 10 Feb 1999 19:54:01 GMT
From: Garry Hodgson <garry@sage.att.com>
Subject: Re: Python vs. Perl vs. tcl ?
Message-Id: <36C1E3D9.27739A3D@sage.att.com>

> | It (Python) also seems to have some awkward non-intuitive syntax.
> | For example, to avoid a newline after the output of a print
> | statement, you add a trailing comma. Now, that is not what I would
> | call intuitive (does it remind of me of Basic??) .. another example,
> | to construct a tuple of one item, add a comma .. again .. not very
> | intuitive.
> 
> I agree that these are weak points in the syntax. However, I can't
> really think of any better alternatives myself,

well, the obvious one for "print" is to give it a newline if you
want one, rather than have to tell it not to add one.  this one
bothered me at first, as well, just because it's ugly.  in practice,
it's not an issue.  and since most of the time i intend "print" to
print a line of text, it declutters the code a bit, not having to
explicitly mention all the newlines.

> and also, they are in
> parts of the language I rarely need. So thankfully the damage is
> limited.
ditto.  and in fact, the trailing comma sort of calls attention
to the fact that you're doing something unusual here.
not such a bad thing.

-- 
Garry Hodgson			comes a time
garry@sage.att.com		when the blind man
Software Innovation Services	takes your hand, says,
AT&T Labs			"don't you see?"


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

Date: Wed, 10 Feb 1999 20:36:31 GMT
From: "Michael P. Reilly" <arcege@shore.net>
Subject: Re: Python vs. Perl vs. tcl ?
Message-Id: <j5mw2.953$wD5.166946@news.shore.net>

In comp.lang.python Ben Gertzfield <che@debian.org> wrote:
:>>>>> "l" == l  <@l@> writes:

:     l> Perl does have some awkward syntax. I don't consider references
:     l> to be one of them, but there are others. Yet, from my Python
:     l> readings so far, I found a lot of similarities between it and
:     l> Perl. It (Python) also seems to have some awkward non-intuitive
:     l> syntax. For example, to avoid a newline after the output of a
:     l> print statement, you add a trailing comma. Now, that is not
:     l> what I would call intuitive (does it remind of me of Basic??) 
:     l> .. another example, to construct a tuple of one item, add a
:     l> comma .. again .. not very intuitive.

: Interestingly enough, these two 'features' (trailing comma to inhibit
: newline on print, trailing comma to make a tuple of one item) are the
: EXACT features that bother me most about Python.

: I adore the fact that Perl has the guts not to play tricks with
: newlines like the standard C/C++ libraries and Python and Java. If you
: ask for a line of input, Perl gives you a line of input -- including
: the newline.

: Thus the distinction between binary and text files is rendered null,
: making Perl an ideal cross-platform tool for programs that need to
: munge binary or text files without a distinction between the two.

: Python has a lot of graceful and excellent features, but I personally
: prefer how Perl's input and output routines never add or remove
: newlines for you -- and never, EVER in Perl do you have to do anything
: like adding a trailing comma to inhibit an automatic newline. Yuck.

The Python "print" statement is for easy scripting, not for file I/O;
its peer is "input(prompt)".

Python's file I/O is similar to Perl's since it uses the same
underlying C libraries, just the interface is different.  A call to
file.readline() does include a newline (if a newline ends the line),
and file.write(str) does not append a newline.  And the function open()
can be opened for binary or ASCII files (similar flags as to fopen()).
A lot of people use sys.stdin, sys.stdout and sys.stderr, which have
the standard Python file object interface (readline, readlines, write,
writelines, etc.).

The big different in the file arena is that Python has a standard
module, os.path, which handles OS-specific pathnames in a consistant
manner.  (I haven't found anything like it in Perl 5.005 yet.)

  os.path.join("tmp", "foo.txt")
yeilds:
  UNIX -> 'tmp/foo.txt'
  DOS  -> 'tmp\\foo.txt'
  MAC  -> 'tmp::foo.txt'
And other OS's can be added.  This makes for very portable
programming.  The existing interface does assume a hierarchical file
organization, but it doesn't take much to build interfaces for other
conceptual models.  Adding/switching drive paths is not as consistant,
but then drives aren't consistant within almost any OS. ;)

  -Arcege



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

Date: 10 Feb 1999 21:15:12 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Python vs. Perl vs. tcl ?
Message-Id: <79sst0$eq2$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Michael P. Reilly
<arcege@shore.net>],
who wrote in article <j5mw2.953$wD5.166946@news.shore.net>:
> Python's file I/O is similar to Perl's since it uses the same
> underlying C libraries, just the interface is different.  

Perl does not use "underlying" C library calls.  See documentation for
$/ to know why.

Ilya


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

Date: Wed, 10 Feb 1999 15:13:22 -0500
From: "Darrel Davis" <darreld@his.com>
Subject: SQL Pass-thru query with Win32::ODBC?
Message-Id: <36c1e806.0@news4.his.com>

Is there a way to issue an SQL query as a passthru (ODBC doesn't try to dink
with the SQL string) in ActivePerl and Win32::ODBC?

Any help appreciated.
-darrel




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

Date: Wed, 10 Feb 1999 21:49:33 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: strict
Message-Id: <N9nw2.609$Uh.7398@nswpull.telstra.net>

In article <36c4a959.10708452@news.skynet.be>,
	bart.lateur@skynet.be (Bart Lateur) writes:
> James Ludlow wrote:
> 
>>I think that in a specialized group like clpm, we should be able to
>>assume at least a basic level of computer literacy.
> 
> Good. We're back at the same question: why isn't there a group for Perl
> newbies?

I think we should stop using these words for all people who aren't
fluent in Perl, which is how it is used a lot.

"perl newbies" ne "programming newbies"
"perl newbies" ne "computer or net newbies"

Most of the people here have no problem with posters who know
programming, but don't know perl yet. Most people here have no problem
with people who know how to use the computer, and understand how
networking works, and the protocols involved.

Most people here do have a problem guiding people through their first
insecure steps using a keyboard instead of a mouse. Most people here
do have problems explaining protocols and programming fundamentals
which are not specific to perl.

Then there is an extra side to this: Some of the people that are new
to this group have no clue how to behave on Usenet, and therefore piss
off many of the people here. It is human nature to generalise, so
others bear the brunt of this.

As there are gradations in Perl hackerism, there are also gradations
in newbieness.

Martien.
-- 
Martien Verbruggen                  | 
Interactive Media Division          | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd.       | population.
NSW, Australia                      | 


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

Date: 10 Feb 1999 20:26:09 GMT
From: siruguri@cs.rice.edu (Sameer Siruguri)
Subject: Re: system call works in command line mode but not from web
Message-Id: <slrn7c3qr0.aij.siruguri@swing.cs.rice.edu>

On Mon, 08 Feb 1999 18:41:22 -0500, Bradley W. Langhorst <bwlang@nospam.genome.wi.mit.edu> wrote:
>
>this works fine if i run my script
>and supply parameters to it from the command line.
>
>However it creates the $tmp2 (the output file)
>but puts no data into it when i run it from the web.


Perhaps your web server runs with a chroot() that disallows it from seeing that
file (/net/...)? $tmp2 would get created anyway, because shells are kinda dumb
and make the stdout file anyway before checking to see if they can indeed run
the executable.

can't see why else this shouldn't work.

-- 
Sameer Siruguri				Graduate student, CS, Rice University
siruguri@cs.rice.edu			www.cs.rice.edu/~siruguri


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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