[22132] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4354 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 7 00:05:58 2003

Date: Mon, 6 Jan 2003 21:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 6 Jan 2003     Volume: 10 Number: 4354

Today's topics:
    Re: A Good Perl Book <jkeen@concentric.net>
        finding largest repeat value in array <hugo@geoinformex.com>
    Re: finding largest repeat value in array <sg7188@snet.net>
    Re: finding largest repeat value in array <krahnj@acm.org>
    Re: finding largest repeat value in array <alecler@sympatico.ca>
        finding largest repeat values in array <hugo@geoinformex.com>
    Re: finding largest repeat values in array <sg7188@snet.net>
    Re: finding largest repreat value in an array <mbudash@sonic.net>
    Re: how to refer to the array? <krahnj@acm.org>
    Re: insert newlines in a long string <goldbb2@earthlink.net>
    Re: insert newlines in a long string (Jay Tilton)
        LWP::Simple - problems with google (Stephen Adam)
    Re: LWP::Simple - problems with google (Sam Holden)
    Re: Noob:  Variable is getting reset, but why? <goldbb2@earthlink.net>
    Re: Noob:  Variable is getting reset, but why? (Jay Tilton)
    Re: Noob:  Variable is getting reset, but why? (Tad McClellan)
        print form from script (Butch)
    Re: Printing  to webpage <captkirk2REMOVEME@mindspring.com>
    Re: Printing  to webpage <flavell@mail.cern.ch>
    Re: Printing  to webpage <captkirk2REMOVEME@mindspring.com>
    Re: Printing  to webpage <jurgenex@hotmail.com>
    Re: Problem with huge dataset, 100000000 a magic number <mgjv@tradingpost.com.au>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 07 Jan 2003 01:12:43 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: A Good Perl Book
Message-Id: <avd9ib$lou@dispatch.concentric.net>


"Steve C" <sjcole@hotmail.com> wrote in message
news:1041892886.117181@ananke.eclipse.net.uk...
> Hiya Folks,
>
> I'm just about to order the O'Reilly book: Programming Perl (Authors Larry
> Wall, Tom Christiansen, Jon Orwant)
> I know there's plenty of online material - but you know, I like to be able
> to read something in the local pub / bar ! (sad !!)
>
> Is this book to be recommended by the many perl gurus on this NG, or
should
> I be considering something different ?
> For information: I have only ever programmed in PASCAL, BASIC, COBOL,
Visual
> Basic (Arrgghh!) and more recntly dabbled with PHP4
>
Programming Perl (popularly known as the Camel book) is the authoritative
source on Perl and every serious Perl programmer must own it.

However, it's not meant to be a textbook so much as a reference.  So if you
want to be guided thru the learning process you should probably get Randal
Schwartz's "Learning Perl" (the Llama book; get 3rd ed.; O'Reilly) or
perhaps Simon Cozen's "Beginning Perl" (Wrox).  You can get a good price on
any O'Reilly or Wrox book at bookpool.com.

HTH

Jim Keenan




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

Date: Tue, 07 Jan 2003 09:39:10 +0800
From: hugo <hugo@geoinformex.com>
Subject: finding largest repeat value in array
Message-Id: <3E1A2FBE.2020300@geoinformex.com>

Hi

I have an array which often contains the same values, i.e.

myArray[0] = "a";
myArray[1] = "b";
myArray[2] = "b";
myArray[3] = "c";
myArray[4] = "c";
myArray[5] = "c";
myArray[6] = "c";

I would like to find the greatest number of identical values in this 
array, which, in the above example is 4, as there are 4 values "c".

I have tried this using a loop, i.e.

for ($i =0; $i < @myArray; $i++) {
   if (myArray[$i] eq myArray[$i -1]) {
    $repeat++;
   }
}

But this does not work as repeat will also add to itself when the array 
contains "b", in the example above.

Can anyone help? Any help, particularly a code example, will be greatly 
appreciated.

Thanks

Hugo

-- 
Dr Hugo Bouckaert
Systems and Programming Engineer

GeoInformatics Exploration Australia P/L
57 Havelock St
West Perth, WA 6005
PO Box 1675, West Perth 6872

Ph:       61 08 9420 7400
Fax:      61 08 9226 1299

www.geoinformex.com

------------------------------------------------------------------------
This email and any attachments may be confidential or legally 
privileged. If you received this message in error or are not the 
intended recipient, you should destroy the e-mail message and any 
attachments or copies, and you are prohibited from retaining, 
distributing, disclosing or using any information contained herein. 
Please inform us of the erroneous delivery by return e-mail. Thank you 
for your cooperation.




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

Date: Tue, 07 Jan 2003 02:14:37 GMT
From: Tom Hamilton <sg7188@snet.net>
Subject: Re: finding largest repeat value in array
Message-Id: <hKqS9.8722$_J5.2323800111@newssvr10.news.prodigy.com>

hugo wrote:

> Hi
> 
> I have an array which often contains the same values, i.e.
> 
> myArray[0] = "a";
> myArray[1] = "b";
> myArray[2] = "b";
> myArray[3] = "c";
> myArray[4] = "c";
> myArray[5] = "c";
> myArray[6] = "c";
> 
> I would like to find the greatest number of identical values in this
> array, which, in the above example is 4, as there are 4 values "c".
> 
> I have tried this using a loop, i.e.
> 
> for ($i =0; $i < @myArray; $i++) {
>    if (myArray[$i] eq myArray[$i -1]) {
>     $repeat++;
>    }
> }
> 
> But this does not work as repeat will also add to itself when the array
> contains "b", in the example above.
> 
> Can anyone help? Any help, particularly a code example, will be greatly
> appreciated.
> 
> Thanks
> 
> Hugo
> 


You should use a hash with the "a", "b" and "c" as keys


#!/usr/bin/perl
$myA[1] = "a";
$myA[2] = "b";
$myA[3] = "b";
$myA[4] = "c";
$myA[5] = "c";
$myA[6] = "c";

for ($i = 1; $i < @myA; $i++)
  { $countlist{$myA[$i]} += 1 }

foreach $list (keys(%countlist)) { print ("$list: $countlist{$list}\n") ;}




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

Date: Tue, 07 Jan 2003 03:42:05 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: finding largest repeat value in array
Message-Id: <3E1A4BFB.DFB9F858@acm.org>

hugo wrote:
> 
> I have an array which often contains the same values, i.e.
> 
> myArray[0] = "a";
> myArray[1] = "b";
> myArray[2] = "b";
> myArray[3] = "c";
> myArray[4] = "c";
> myArray[5] = "c";
> myArray[6] = "c";
> 
> I would like to find the greatest number of identical values in this
> array, which, in the above example is 4, as there are 4 values "c".
> 
> I have tried this using a loop, i.e.
> 
> for ($i =0; $i < @myArray; $i++) {
>    if (myArray[$i] eq myArray[$i -1]) {
>     $repeat++;
>    }
> }
> 
> But this does not work as repeat will also add to itself when the array
> contains "b", in the example above.
> 
> Can anyone help? Any help, particularly a code example, will be greatly
> appreciated.

Use a hash to keep a count of the values:

my @myArray = qw/ a b b c c c c /;

my %count;
my $largest = 0;
for ( @myArray ) {
    $count{$_}++;
    $largest = $count{$_} if $largest < $count{$_};
    }

for ( keys %count ) {
    print 'Largest: $_  Count: $count{$_}\n" if $largest == $count{$_};
    }



John
-- 
use Perl;
program
fulfillment


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

Date: Mon, 06 Jan 2003 22:42:54 -0500
From: Andre <alecler@sympatico.ca>
Subject: Re: finding largest repeat value in array
Message-Id: <alecler-6D1C80.22425406012003@news1.qc.sympatico.ca>

In article <3E1A2FBE.2020300@geoinformex.com>, hugo 
<hugo@geoinformex.com> wrote:

> I have an array which often contains the same values, i.e.
> 
[...]
> I would like to find the greatest number of identical values in this 
> array, which, in the above example is 4, as there are 4 values "c".
[...]


#!/usr/bin/perl -w
use strict; 

my @a = qw(a b b c c c c);

# make a hash where the keys are the unique elements of @a, and 
# the values, the number of times they appear in the array
my %h;
$h{$_}++ for @a;

# find the largest value (lazy version)
my $largest = (sort {$b <=> $a} values %h)[0];
print "$largest\n";


HTH,
Andre


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

Date: Tue, 07 Jan 2003 10:20:34 +0800
From: hugo <hugo@geoinformex.com>
Subject: finding largest repeat values in array
Message-Id: <3E1A3972.6090407@geoinformex.com>

Hi

I have an array which often contains the same values, i.e.

myArray[0] = "a";
myArray[1] = "b";
myArray[2] = "b";
myArray[3] = "c";
myArray[4] = "c";
myArray[5] = "c";
myArray[6] = "c";

I would like to find the greatest number of identical values in this 
array, which, in the above example is 4, as there are 4 values "c".

I have tried this using a loop, i.e.

for ($i =0; $i < @myArray; $i++) {
   if (myArray[$i] eq myArray[$i -1]) {
    $repeat++;
   }
}

But this does not work as repeat will also add to itself when the array 
contains "b", in the example above.

Can anyone help? Any help, particularly a code example, will be greatly 
appreciated.

Thanks

-- 
Dr Hugo Bouckaert
Systems and Programming Engineer

GeoInformatics Exploration Australia P/L
57 Havelock St
West Perth, WA 6005
PO Box 1675, West Perth 6872

Ph:       61 08 9420 7400
Fax:      61 08 9226 1299

www.geoinformex.com

------------------------------------------------------------------------
This email and any attachments may be confidential or legally 
privileged. If you received this message in error or are not the 
intended recipient, you should destroy the e-mail message and any 
attachments or copies, and you are prohibited from retaining, 
distributing, disclosing or using any information contained herein. 
Please inform us of the erroneous delivery by return e-mail. Thank you 
for your cooperation.



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

Date: Tue, 07 Jan 2003 02:47:55 GMT
From: Tom Hamilton <sg7188@snet.net>
Subject: Re: finding largest repeat values in array
Message-Id: <vdrS9.8732$me6.2325904399@newssvr10.news.prodigy.com>

hugo wrote:

> Hi
> 
> I have an array which often contains the same values, i.e.
> 
> myArray[0] = "a";
> myArray[1] = "b";
> myArray[2] = "b";
> myArray[3] = "c";
> myArray[4] = "c";
> myArray[5] = "c";
> myArray[6] = "c";
> 
> I would like to find the greatest number of identical values in this
> array, which, in the above example is 4, as there are 4 values "c".
> 
> I have tried this using a loop, i.e.
> 
> for ($i =0; $i < @myArray; $i++) {
>    if (myArray[$i] eq myArray[$i -1]) {
>     $repeat++;
>    }
> }
> 
> But this does not work as repeat will also add to itself when the array
> contains "b", in the example above.
> 
> Can anyone help? Any help, particularly a code example, will be greatly
> appreciated.
> 
> Thanks
> 
You should use a hash with the "a", "b" and "c" as keys


#!/usr/bin/perl
$myA[1] = "a";
$myA[2] = "b";
$myA[3] = "b";
$myA[4] = "c";
$myA[5] = "c";
$myA[6] = "c";

for ($i = 1; $i < @myA; $i++)
  { $countlist{$myA[$i]} += 1 }

foreach $list (keys(%countlist)) { print ("$list: $countlist{$list}\n") ;}


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

Date: Tue, 07 Jan 2003 02:17:05 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: finding largest repreat value in an array
Message-Id: <mbudash-8D6E84.18170506012003@typhoon.sonic.net>

In article <3E1A2B58.5020501@geoinformex.com>,
 hugo <hugo@geoinformex.com> wrote:

> Hi
> 
> I have an array which often contains the same values, i.e.
> 
> myArray[0] = "a";
> myArray[1] = "b";
> myArray[2] = "b";
> myArray[3] = "c";
> myArray[4] = "c";
> myArray[5] = "c";
> myArray[6] = "c";
> 
> I would like to find the greatest number of identical values in this 
> array, which, in the above example is 4, as there are 4 values "c".
> 
> I have tried this using a loop, i.e.
> 
> for ($i =0; $i < @myArray; $i++) {
>    if (myArray[$i] eq myArray[$i -1]) {
>     $repeat++;
>    }
> }
> 
> But this does not work as repeat will also add to itself when the array 
> contains "b", in the example above.
> 
> Can anyone help? Any help, particularly a code example, will be greatly 
> appreciated.
> 
> Thanks
> 
> Hugo

you don't say what to do if two or more have the same numbers of 
occurences, but ... here is one way:

my @myarray = qw/a b b c c c c/;

my %myhash;

$myhash{$_}++ foreach @myarray;

print "greatest is: ",
       (sort { $myhash{$b} <=> $myhash{$a} } keys %myhash)[0]
      "\n";

hth-


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

Date: Tue, 07 Jan 2003 01:46:35 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: how to refer to the array?
Message-Id: <3E1A30ED.3C8D880E@acm.org>

"Michael Peuser (h)" wrote:
> 
> "John W. Krahn" <krahnj@acm.org> schrieb im Newsbeitrag
> news:3E196C59.6A71E7EA@acm.org...
> 
> > No need to quote everything.  :-)
> 
> Exactly :-)
> 
> > push @{$countyInfo{$_}[1]}, 11111 for keys %countyInfo;
> 
> I think the previous line should read:
> push @{$countyInfo{$_}  ->  [1]}, 11111 for keys %countyInfo;

It worked fine when I tested it.


John
-- 
use Perl;
program
fulfillment


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

Date: Mon, 06 Jan 2003 18:33:58 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: insert newlines in a long string
Message-Id: <3E1A1266.10BD9CD7@earthlink.net>

steven farris wrote:
> 
> Hello, how could i take a long string in perl
> and insert newlines at the whitespace nearest
> to 80 chars? So a string that contains 320 chars
> would have roughly 5 newlines inserted into
> it.

use Text::AutoFormat; # from CPAN

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Mon, 06 Jan 2003 23:30:42 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: insert newlines in a long string
Message-Id: <3e1a1192.111356510@news.erols.com>

"Kasp" <kasp@epatra.com> wrote:

: "steven farris" <sfarris9@insightbb.com> wrote in message
: news:9blS9.461377$pN3.49819@sccrnsc03...
: > Hello, how could i take a long string in perl
: > and insert newlines at the whitespace nearest
: > to 80 chars? So a string that contains 320 chars
: > would have roughly 5 newlines inserted into
: > it.
: 
: I think what you need exactly is that whatever be the whitespace just
: before/closest to 80 character (column margin), it should be replaced by
: \n...Right?

What should happen when there is a substring of eighty or more
characters that is not broken by whitespace?

The "what if" cases will kill ya.  :)



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

Date: 6 Jan 2003 17:54:39 -0800
From: 00056312@brookes.ac.uk (Stephen Adam)
Subject: LWP::Simple - problems with google
Message-Id: <945bf980.0301061754.2f2e9da5@posting.google.com>

Hi guys and girls 

I'm tring to get dynamic content from a couple of web search engines. 

I am using LWP::Simple and "get" to download search engine results.
This works fine for Yahoo (as the code below will show). However
google aint playing ball.

If you run the example below yahoo works fine but I don't get anything
from google. This is just a simple example with no variables being
used in the search, i've just copied and pasted the address of a
search done using both engines. Can anyone shed any light on this
problem?

Thanks 

Steve 

#!C:\perl\perl.exe -w

use strict;
use warnings; 
use LWP::Simple;

my $doc = get 'http://search.yahoo.com/bin/search?p=steve';

print $doc; 

$doc = get 'http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=steve';

print $doc; 

exit(0);


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

Date: 7 Jan 2003 02:37:08 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: LWP::Simple - problems with google
Message-Id: <slrnb1kfaj.m11.sholden@flexal.cs.usyd.edu.au>

On 6 Jan 2003 17:54:39 -0800, Stephen Adam <00056312@brookes.ac.uk> wrote:
> Hi guys and girls 
> 
> I'm tring to get dynamic content from a couple of web search engines. 
> 
> I am using LWP::Simple and "get" to download search engine results.
> This works fine for Yahoo (as the code below will show). However
> google aint playing ball.
> 
> If you run the example below yahoo works fine but I don't get anything
> from google. This is just a simple example with no variables being
> used in the search, i've just copied and pasted the address of a
> search done using both engines. Can anyone shed any light on this
> problem?
> 
[snip to essentials...]
> use LWP::Simple;
> $doc = get 'http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=steve';
> print $doc; 

Google doesn't like people doing such things, they have their web API
(http://www.google.com/apis/index.html) for doing searches... I'm 
not sure if they just don't like *everyone* using google when they
are playing with LWP::Simple, or if it's more general...

They implement it by checking user agents. You can thus change the user
agent to get it to work. 

For example:

use LWP::Simple qw/$ua get/;
$ua  = LWP::UserAgent->new(env_proxy => 1, agent => 'a searching we will go');
$doc = get 'http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=steve';
print $doc;

Should work (pretending to be a real browser might work for longer).

Google used to output a 'usage policy' type page when you did such things,
rather than a '403 Forbidden', the choice of error codes may indicate that
they don't want you doing that at all...

Mmm... I can't think of a way of pretending this is on topic :)

-- 
Sam Holden


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

Date: Mon, 06 Jan 2003 18:31:30 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Noob:  Variable is getting reset, but why?
Message-Id: <3E1A11D2.8E6E4D94@earthlink.net>

Jack Straw wrote:
> 
> Brian McCauley <nobull@mail.com>:
> 
> >Jack Straw <jackstraw@witchita> writes:
> >
> >> Subject: Noob:  Variable is getting reset, but why?
> >
> >"Noob" will be read as "person too lazy to read the manual and can't
> >even spell newbie".
> 
> Well, it should be read as someone who's not very confident in what
> they're doing, and is willing to admit as such.
> 
> >If this is the case then please read the manuals before you posr.
> 
> I have read Learning, Programming, and Cookbook, but that's a lot
> different that understanding everything.  Perl has been rather
> difficult for me, I'm having a hard time understandg how Perl thinks,
> 'cause it seems like alot more is impied than in other languages.

But these aren't the perl manuals!  They're the perl books, and are
meant as a *supplement* to perl's documentation.

To read perl's documentation, use the 'perldoc' command that comes with
perl.

I would suggest you start by reading 'perldoc perl', for a list of
sections, and then read whichever section(s) you feel to be most
appropriate.

Considering your lack of understanding of perl's regular expressions, I
would suggest: 'perldoc perlrequick', 'perldoc perlretut', and 'perldoc
perlre'.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Mon, 06 Jan 2003 23:28:46 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Noob:  Variable is getting reset, but why?
Message-Id: <3e1a0058.106946142@news.erols.com>

Jack Straw <jackstraw@witchita> wrote:

: Brian McCauley <nobull@mail.com>:
: 
: >Jack Straw <jackstraw@witchita> writes:
: >
: >> Subject: Noob:  Variable is getting reset, but why?
: >
: >"Noob" will be read as "person too lazy to read the manual and can't
: >even spell newbie".
: 
: Well, it should be read as someone who's not very confident in what
: they're doing, and is willing to admit as such.

There's extra baggage attached to it.

The group's common experience is that self-described newbies often
want somebody to write a program for them, to perform menial
debugging, or to read some documentation to them.  Savvy readers tend
to ignore those threads from the start and move on to something more
likely to be interesting or rewarding.

The OP's level of expertise rarely matters.  When it does, and the
article's content doesn't make it apparent, readers will ask the OP
and tailor the response to fit, or the OP will ask for clarification
of the response.

: >If this is the case then please read the manuals before you posr.
: 
: I have read Learning, Programming, and Cookbook, but that's a lot
: different that understanding everything.  

There are manuals other than the dead tree variety.  A non-broken Perl
will have its own documentation, accessible through the perldoc
utility.

The newsgroup itself has a manual of sorts in the posting guidelines.
It's a recommended read.

: being overly-harsh doesn't do much for perl advocacy either.

There was clearly a gap between how nobull interpreted "noob" and how
you meant it.  The newbie the response was written for may have found
its advice on debugging and writing effective newsgroup posts
beneficial, but you evidently found it critical or condescending.

So, even worse than being a simple content-free word in the subject,
its net effect was actually disruptive.

: What I get is "Use of uninitialized value", which doesn't make any
: sense at all to me.  

That is useful information.  Any warnings or errors emitted by the
program are generally worth mentioning in a problem statement.

: If it's inside of the IF condition with the
: match, then how could the $1 *not* be initialized?  

Whether $1 is defined is not the condition.
The entire match is the condition.

: >Your regex was:
: >
: >>  /^.{183}Y00545|Y01779|Y07001.{60}(.{10})/
: >
: >You meant:
: >
: >  /^.{183}(?:Y00545|Y01779|Y07001).{60}(.{10})/
:
: I have no idea what your change does, would you explain it please?

Back to the manuals.  Did the explanation in perlre not explain it
adequately?

    (?:pattern)
    (?imsx-imsx:pattern)
        This is for clustering, not capturing; it groups 
        subexpressions like ``()'', but doesn't make 
        backreferences as ``()'' does.



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

Date: Mon, 6 Jan 2003 22:14:15 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Noob:  Variable is getting reset, but why?
Message-Id: <slrnb1kl0n.e9p.tadmc@magna.augustmail.com>

Jack Straw <jackstraw@witchita> wrote:
> Brian McCauley <nobull@mail.com>:
>>Jack Straw <jackstraw@witchita> writes:
>>
>>> Subject: Noob:  Variable is getting reset, but why?
>>
>>"Noob" will be read as "person too lazy to read the manual and can't
         ^^^^^^^
>>even spell newbie".
> 
> Well, it should be read as someone who's not very confident in what
           ^^^^^^^^^
> they're doing, and is willing to admit as such.


Yes, it (perhaps) should be.

But it isn't.

Brian's been here for a long time, he knows us.

He is just telling you how we will see it.

Better to not do it rather than to attempt to change all of our minds.

So, try to not get all huffy about it (even though Brian was gruff),
take it as learning opportunity.

I, for instance, have "newbie" scored down, but I have 
"beginner" scored *up*.


> I have read Learning, Programming, and Cookbook,


But books are only a third-level resource, I hope you're not
missing out on #1 and #2:

   1) the standard docs that ship with perl itself, they are
      already installed on your hard drive

   2) http://groups.google.com/advanced_group_search


>>If this is _not_ the case then why waste valuable space in your
>>subject line to give the wrong impression?


Apart from that, the purpose of a Subject header is to describe
the subject of your article.

Your article was not about being a newbie, so it should not
say that it is.


>>Have you actually tried running under the debugger or putting in some
>>dianostic prints to see if the variable really is getting reset?
>>
>>No, you haven't.
> 
> Yes, of course I have. 


We can't know what you've tried if you don't tell or show
us what you've tried. We can often appear prescient, but
that is just an illusion.  :-)

Your OP didn't mention any of that, so we are forced to guess...


>>It was just a wild, and completely inaccurate, guess.


 ... perhaps we'll guess wrong.

Best to just tell us what else you tried so we don't have
to speculate.


> It may have been inaccurate, but it's not wild.  I've been working on
> this for a while, and do not feel guilty for not having done my
> research.  On the one hand, I undestand frustrations with stupid
> questions, but on the other hand, being overly-harsh doesn't do much
> for perl advocacy either.  


On the one hand, we was rather harsh.

On the other hand, there is no assumption that we _need_ more
Perl programmers.  :-)


>>I notice that you did enable warnings.  And the warnings your code
>>generates should have given a big clue as to what was wrong.
> 
> What I get is "Use of uninitialized value", which doesn't make any
> sense at all to me.  


Think "I've used undef" when you see that warning message.


> If it's inside of the IF condition with the
> match, then how could the $1 *not* be initialized?  


It is set to undef when the matching part of the pattern does
not contain parenthesis.


>>Your regex may match 3 different tagets but only in one is anything
>>captured in $1.


In the other two, $1 is undef.


> PS:  Hope your day gets better, seriously.


Getting wise ass with the regulars is not advised.

Even when they overreact. Do your best to shrug it off, or
risk reduced readership for all of your future articles.



I've seen about a half-dozen things in this one post that
the Posting Guidelines warn folks off of, perhaps you
haven't seen them yet?

   http://mail.augustmail.com/~tadmc/clpmisc.shtml


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 6 Jan 2003 18:38:27 -0800
From: webmaster@2clones.com (Butch)
Subject: print form from script
Message-Id: <1921f571.0301061838.6935ca35@posting.google.com>

I'm teaching myself Perl and started what I thought was a simple
project but am stuck.  I want to call the script to have it print a
form from a sub routine but cannot get it to work.  If I call *sub
form* in the script using &form; it works but when I try to call it
from the browser using /script.pl?action=form I get a server error.

This script is to make some very calculations and I'd hoped to call
different sub routines for different forms.  What piece of the puzzle
am I missing?

Butch


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

Date: Mon, 06 Jan 2003 15:54:56 -0800
From: 'Captain' Kirk DeHaan <captkirk2REMOVEME@mindspring.com>
Subject: Re: Printing  to webpage
Message-Id: <cn5k1v0k0ddiisiv43af1g92tapbn11ufr@4ax.com>

On Mon, 6 Jan 2003 16:02:12 -0600, tadmc@augustmail.com (Tad
McClellan) wrote:

>Kasp <kasp@epatra.com> wrote:
>> "'Captain' Kirk DeHaan" <captkirk2REMOVEME@mindspring.com> wrote in message
>> news:monj1vsi8qsphs8qrg6j4aepcu8nnl6lci@4ax.com...
>
>>> I am trying to output some info to a webpage but keep getting server
>>> errors.
>
>
>> Captain, your question is off-topic. Please discuss Perl only here!
>> Try a HTML related group.
>
>
>Errr, the question would be off-topic in an HTML newsgroup too...


Well, if your NEW to these languages how the f*** are you supposed to
know where it pertains?  Not a dig but a serious question.


Kirk

"There's a lot to be said 
 for a blow to the head", BOC.

www.mindspring.com/~captkirk2/
www.stormyacres.com



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

Date: Tue, 7 Jan 2003 01:05:00 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Printing  to webpage
Message-Id: <Pine.LNX.4.40.0301070101460.18099-100000@lxplus067.cern.ch>

On Jan 6, 'Captain' Kirk DeHaan inscribed on the eternal scroll:

> Well, if your NEW to these languages how the f*** are you supposed to
> know where it pertains?  Not a dig but a serious question.

Seems you've omitted to consult the posting guidelines for this group.

So it's into the regular killfile with you, and when that expires,
either you'll have positioned yourself to participate constructively
in discussions, or you'll have given up.  Either would be fine by me:
usenet is very democratic, you know.


-- 
            "DO NOT READ WHILST THE BOX IS OPEN!"   - warning
             printed on the underside of a product package.  (honestly!)



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

Date: Mon, 06 Jan 2003 16:40:33 -0800
From: 'Captain' Kirk DeHaan <captkirk2REMOVEME@mindspring.com>
Subject: Re: Printing  to webpage
Message-Id: <qf8k1vkca1moc3i5ft51god5d03k6e7qrd@4ax.com>

On Tue, 7 Jan 2003 01:05:00 +0100, "Alan J. Flavell"
<flavell@mail.cern.ch> wrote:

>On Jan 6, 'Captain' Kirk DeHaan inscribed on the eternal scroll:
>
>> Well, if your NEW to these languages how the f*** are you supposed to
>> know where it pertains?  Not a dig but a serious question.
>
>Seems you've omitted to consult the posting guidelines for this group.
>
>So it's into the regular killfile with you, and when that expires,
>either you'll have positioned yourself to participate constructively
>in discussions, or you'll have given up.  Either would be fine by me:
>usenet is very democratic, you know.

Oh well.



Kirk

"There's a lot to be said 
 for a blow to the head", BOC.

www.mindspring.com/~captkirk2/
www.stormyacres.com


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

Date: Tue, 07 Jan 2003 03:47:53 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Printing  to webpage
Message-Id: <J5sS9.7189$1c.61@nwrddc01.gnilink.net>

'Captain' Kirk DeHaan wrote:
> What is the proper syntax in Perl to output text, using print(?),

You would use e.g.
    print "Hello World\n";

> to a webpage?

Please define "webpage". Do you mean an HTML file?
Then just open it and then print to the file handle:
    open FOO, "foo.html";
    print FOO "Hello World\n";

jue




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

Date: Mon, 06 Jan 2003 23:27:17 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Problem with huge dataset, 100000000 a magic number?
Message-Id: <slrnb1k46l.2j6.mgjv@verbruggen.comdyn.com.au>

On Mon, 06 Jan 2003 22:40:53 GMT,
	Mike Hunter <mthunter@students.uiuc.edu> wrote:
> On Mon, 06 Jan 2003 22:32:03 GMT, Martien Verbruggen wrote:
>>  On Mon, 06 Jan 2003 18:42:20 GMT,
>>  	Mike Hunter <mthunter@students.uiuc.edu> wrote:
>> > On Sun, 05 Jan 2003 22:01:35 GMT, Martien Verbruggen wrote:
> 
>> >>  Could it be that somewhere around line 100000000 you pass the 2 GB
>> >>  mark [1]? Is the file larger than 2 GB, and if so, does your Perl on your
>> >>  OS support that?
>> > 
>> > How does one tell what the local limits are?
>>  
>>  perl -V will tell you whether it was compiled with large file support.
>>  Look for acompile-time-option of USE_LARGE_FILES.
> 
> Thanks.  perl -V says (among other things):
> 
> uselargefiles=define

Then that should be ok, and the problem is probably something else.

> So I don't think that's the problem.  I'm starting to think that the
> number was indeed a coincidence.  Naturally, the problem has not
> reoccured since I added the code to print out the exact line number :)

Heh  :)

That always happens. However, it does mean that, unless you changed
other things, the problem is probably somewhere else. If you change
the code back to the original, does the problem re-occur at the same
spot? If so, there could be some bug, if not (it doesn re-occur, or it
occurs at a different spot) I suspect you're running into some system
limit.

Martien
-- 
                        | 
Martien Verbruggen      | 
Trading Post Australia  | In a world without fences, who needs Gates?
                        | 


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.

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 V10 Issue 4354
***************************************


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