[18096] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 256 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 9 11:05:45 2001

Date: Fri, 9 Feb 2001 08:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <981734712-v10-i256@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 9 Feb 2001     Volume: 10 Number: 256

Today's topics:
        [OT] What does "newbie" mean? (was Re: This is driving  (Tad McClellan)
    Re: CPAN for win32 <kliquori@my-deja.com>
    Re: Devel DProf and " dprofpp " <mothra@nowhereatall.com>
    Re: flock unavailable on many platforms <bart.lateur@skynet.be>
        Food for guru's: read/modify/write works under Linux, n <fw@lanvision.nl>
    Re: Food for guru's: read/modify/write works under Linu <bart.lateur@skynet.be>
    Re: fperl:ile -newer file2 (Garry Williams)
    Re: How to run Perl on Windows 2000? <ilogix@hotmail.com>
        howto split without regard to white spaces? neutron16@my-deja.com
    Re: howto split without regard to white spaces? mintcake@my-deja.com
    Re: Net::FTP error - timeout on put() <jkitchin@udel.edu>
    Re: Partial Apology to Perl Fans <joe+usenet@sunstarsys.com>
    Re: reading config file with do <cote71@home.com>
    Re: sending attachments <pobbard@hotresponse.com>
        Sending email from Perl Script on NT jgunnip@my-deja.com
    Re: Specifying the length of regular expression (Greg Bacon)
        Splitting a quote-comma delimitted string <eric.kort@vai.org>
    Re: Splitting a quote-comma delimitted string (John Joseph Trammell)
        Thank you! <pobbard@hotresponse.com>
    Re: This is driving me nuts and I need a guru (Tad McClellan)
    Re: This is driving me nuts and I need a guru mintcake@my-deja.com
        Two dimensional arrays tunneling@my-deja.com
    Re: Two dimensional arrays bits101010@my-deja.com
    Re: Two dimensional arrays (Damian James)
    Re: Using regex to match numbers (not digits)? Gordon.Haverland@agric.gov.ab.ca
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 09 Feb 2001 14:32:49 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: [OT] What does "newbie" mean? (was Re: This is driving me nuts and I need a guru)
Message-Id: <slrn987n69.dkd.tadmc@tadmc26.august.net>

David H. Adler <dha@panix6.panix.com> wrote:
>On Thu, 08 Feb 2001 23:51:52 GMT, Tad McClellan <tadmc@augustmail.com> wrote:
>>
>>   You don't (or shouldn't anyway) get flamed here for being
>>   new to Perl. You get flamed here for being new to Usenet.
>
>As much as I respect Tad, I need to disagree slightly.
>
>Being new to Usenet doesn't get you flamed.  Not bothering to find out
>how one is expected to act on Usenet (and taking that to heart) gets
>you flamed.


We don't disagree at all. I think I didn't make my point clear.
I probably should have had a separate followup for making it.
So here's what I was trying to say again (along with a Subject change):

A poster says "newbie gets flamed".

The poster is thinking "gets flamed for not knowing Perl"
(which shouldn't happen in a Perl newsgroup).

Usenauts think "gets flamed for not knowing netiquette"
(most always the "check docs before posting" part of netiquette).

Usenauts see no problem, new folks do.

   Use of an unqualified "newbie" is a disservice to the community.

We should be saying "Perl newbie" or "Usenet newbie" as applicable.


This semantic conflict is made worse by the high incidence of *both* of
those applying at once, potentially masking which one it was
you broke so you can learn to not break it again.

It is easy to avoid Usenet faux pas. Just read up on netiquette
or lurk a while before diving in with a post. A high-traffic
newsgroup is bound to have a number of posts where neither
of those has been done, so we have netiquette threads twice
a week, despite it being off-topic here   :-(


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


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

Date: Fri, 09 Feb 2001 14:27:02 GMT
From: kliquori <kliquori@my-deja.com>
Subject: Re: CPAN for win32
Message-Id: <960und$u0b$1@nnrp1.deja.com>

Yes, this helped. Thanks. I already had Cygwin's tools so I had things like
make, tar, etc.

Thanks again!
 ...Kevin

In article <3A82D024.3264BAC9@nowhereatall.com>,
  mothra <mothra@nowhereatall.com> wrote:
> kliquori wrote:
> >
> > Does anyone know if there's a CPAN.pm for ActiveState's Win32 distribution?
> > I've been having problems with ppm. I found documentation for CPAN.pm on
> > their site but cannot find the ppm module for CPAN.pm.
> >
> perl is distributed with the CPAN module included. To use it type
>
> perl -MCPAN -e shell at the dos prompt. If it is the first time this is
> run
> you will be prompted for locations of utilities that is needed for the
> module
> to function correctly. Be warned, most of what is needed does not come
> with the
> windows product ( tar gzip ...) you will need to find and install these.
> you
> will also need nmake.exe. This is required to build many modules that
> are located
> in the CPAN resposortory.
>
> I hope this helps.
>
> Mothra!
>


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 09 Feb 2001 07:35:39 -0800
From: mothra <mothra@nowhereatall.com>
Subject: Re: Devel DProf and " dprofpp "
Message-Id: <3A840E4B.54960060@nowhereatall.com>

"Godzilla!" wrote:
[snipped]
> I have found a reference for dprofpp. However, typical
> of Perl documentation, it is gibberish. Additionally
> I have discovered the syntax provided by documentation
> for dprofpp, will not compile.

I was able to use this utiltiy without problem. What was the error?
Here is what I used to run the utility.

D:\scripts>dprofpp -u -p dbitest.pl

[output of script was here]

Total Elapsed Time = -0.00744 Seconds
         User Time = 0.283118 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
 38.1   0.108  0.139      3   0.0360 0.0463  main::BEGIN
 16.6   0.047  0.047      1   0.0470 0.0470  DBD::Ingres::db::_login
 10.9   0.031  0.031      3   0.0103 0.0103  DynaLoader::dl_load_file
 10.9   0.031  0.029    300   0.0001 0.0001  DBI::st::fetchrow_array
 5.65   0.016  0.016      1   0.0160 0.0160  Exporter::export
 5.65   0.016  0.016      1   0.0160 0.0160  Date::Calc::BEGIN
 0.00   0.000  0.031      3   0.0000 0.0102  DynaLoader::bootstrap
 0.00   0.000 -0.000      3   0.0000      -  DynaLoader::dl_load_flags
 0.00   0.000 -0.000      3   0.0000      - 
DynaLoader::dl_undef_symbols
 0.00   0.000 -0.000      3   0.0000      -  DynaLoader::dl_find_symbol
 0.00   0.000 -0.000      3   0.0000      -  DynaLoader::dl_install_xsub
 0.00   0.000 -0.000      1   0.0000      -  Date::Calc::bootstrap
 0.00   0.000 -0.000      1   0.0000      -  Exporter::heavy_export
 0.00   0.000 -0.000      8   0.0000      -  DBI::BEGIN
 0.00   0.000 -0.000      1   0.0000      -  Exporter::export_ok_tags

D:\scripts>
[snipped]
> 
> Perl documentation indicates to read dprofpp man. There is
> no such manual to be found, in my efforts.

You are correct, there is no man page for this. However I was able
to find the information on the profile format of the tmon.out file.
It is located in the DProf.pm file ( I include only a portion of 
this due to space)

=head1 PROFILE FORMAT

The old profile is a text file which looks like this:

	#fOrTyTwO
	$hz=100;
	$XS_VERSION='DProf 19970606';
	# All values are given in HZ
	$rrun_utime=2; $rrun_stime=0; $rrun_rtime=7
	PART2
	+ 26 28 566822884 DynaLoader::import
	- 26 28 566822884 DynaLoader::import
	+ 27 28 566822885 main::bar
	- 27 28 566822886 main::bar
	+ 27 28 566822886 main::baz
	+ 27 28 566822887 main::bar
	- 27 28 566822888 main::bar
	[....]
The first line is the magic number.  The second line is the hertz value,
or
clock ticks, of the machine where the profile was collected.  The third
line
is the name and version identifier of the tool which created the
profile.
The fourth line is a comment.  The fifth line contains three variables
holding the user time, system time, and realtime of the process while it
was
being profiled.  The sixth line indicates the beginning of the sub
entry/exit profile section.

NOTE: I am running activestate 5.6.0
      Locally applied patches:
      ActivePerl Build 620
      Built under MSWin32
 
I hope this helps!!

Mothra!

> My presumption is you boys don't know anything about
> dprofpp or are so intimidated by me, you are fearful
> to post useful information.
> 
> There are times I question why people bother to document
> Perl. My experience is far too much of Perl documentation
> is gibberish, runs around in pointless and endless circles
> or simply doesn't exist when it is claimed to exist.
> 
> Come on boys, get your act together and write some decent
> documentation for Perl.
> 
> Godzilla!
> 
> * thinks she will not share her discoveries about dprofpp *


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

Date: Fri, 09 Feb 2001 15:27:50 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: flock unavailable on many platforms
Message-Id: <64388t4g0kl3kjq3ucfmm0cma5ja05ogl9@4ax.com>

John Lin wrote:

>OK, now I open for read-write but don't really write anything.
>
>open F,'+< file.lock' or die "please create 'file.lock' first\n";

You can always try

	open F,'>> file.lock'

which shouldn't fail for that reason you mentioned.

-- 
	Bart.


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

Date: Fri, 09 Feb 2001 15:58:13 +0100
From: Frank van Wensveen <fw@lanvision.nl>
Subject: Food for guru's: read/modify/write works under Linux, not under Solaris. Please help!
Message-Id: <s0188t0g10cds3ei5habejl5gsngsh1hbg@4ax.com>

Is there a guru in the audience?
I have a rather simple piece of code that reads lines from a text
file, modifies one of them (change an ASCII "0" character into "1",
the line length stays the same), does a seek() back to the start of
the line, writes the modified line, and continues reading lines. This
works fine under Linux, but under Solaris 2.7 the file is corrupted
and reads after the modify/write operation return garbage. Both
systems run Perl 5.005_03.
I'm thoroughly stumped. Am I overlooking something?

*** Offending code ahead ***

#!/usr/bin/perl -w

main: {  
  $| = 1;                                       # Autoflush stdout
  $count = 0;

  open (EXTRACT, "+<datfile") || die ("Error opening file");
  seek (EXTRACT, 0, 0);                         # Rewind

  do {
    $line = <EXTRACT>;
    print "Read: $line";                        # These lines read OK
    if (++$count == 5) {                        # Modify only one line
      $offset = tell (EXTRACT);
      $line = <EXTRACT>;
      print "--> Read: $line";                  # This still read OK
      $line =~ s/0/1/g;                         # Modify: replace 0->1
      print "Write: $line";                     # Line is modified
      seek (EXTRACT, $offset, 0);               # To start of line
      print EXTRACT $line;                      # Write modified line
    }
    # SUBSEQUENT READS OK UNDER LINUX, RETURN GARBAGE UNDER SOLARIS
  } until eof (EXTRACT);

  seek (EXTRACT, 0, 2);                         # To EOF
  print EXTRACT "Last line\n";                  # Add line
  close (EXTRACT);
}




FVW


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

Date: Fri, 09 Feb 2001 15:33:23 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Food for guru's: read/modify/write works under Linux, not under Solaris. Please help!
Message-Id: <99388tcf4q4iu6uvc3tql0bga6e3c802e1@4ax.com>

Frank van Wensveen wrote:

>Is there a guru in the audience?
>I have a rather simple piece of code that reads lines from a text
>file, modifies one of them (change an ASCII "0" character into "1",
>the line length stays the same), does a seek() back to the start of
>the line, writes the modified line, and continues reading lines. This
>works fine under Linux, but under Solaris 2.7 the file is corrupted
>and reads after the modify/write operation return garbage. Both
>systems run Perl 5.005_03.
>I'm thoroughly stumped. Am I overlooking something?

You likely have a buffering problem.

In your place, I'd attempt to do a seek(FILE, 0, 1) after writing, and
before continuing reading.

-- 
	Bart.


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

Date: Fri, 09 Feb 2001 14:08:23 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: fperl:ile -newer file2
Message-Id: <rRSg6.963$OO2.1150@eagle.america.net>

On Fri, 09 Feb 2001 13:36:57 +0100, Daniel Heiserer
<daniel.heiserer@bmw.de> wrote:

>how can I check in perl if one file is newer then
>another one.
>I only have seen unary operators for files.

Of course, that's all you need.  _Their_ results can be compared.  

  if ( -M $file1 > -M $file2 ) { ... }

You might want to review the perlsyn manual page.  

>--------------33B168F0BD475C6062170705
>Content-Type: text/x-vcard; charset=us-ascii;
> name="daniel.heiserer.vcf"
>Content-Transfer-Encoding: 7bit
>Content-Description: Card for Daniel Heiserer
>Content-Disposition: attachment;
> filename="daniel.heiserer.vcf"
>
>begin:vcard 

I don't understand this part.  Maybe you should adjust your news
reader to omit this stuff when posting.  

-- 
Garry Williams


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

Date: Fri, 09 Feb 2001 15:53:18 GMT
From: "Sean" <ilogix@hotmail.com>
Subject: Re: How to run Perl on Windows 2000?
Message-Id: <OnUg6.5460$TR6.169244@sodalite.nbnet.nb.ca>

Thanks for your reply. But our needs are more than met with Windows 2000
server. All I really wanted to know is how to run Perl on Windows
2000.....thanks again.

-Sean-

"Damian James" <damian@qimr.edu.au> wrote in message
news:slrn986g45.giv.damian@puma.qimr.edu.au...
> Thus spake Sean on Fri, 09 Feb 2001 00:14:49 GMT:
> >Having never worked with Perl before, I would really appreciate some
advice
> >on how to run Perl CGI scripts on Windows 2000 server...any
recommendations
> >on interpreters etc? thanks in advance.
> >
>
> You should investigate Indigo Perl (http://www.indigostar.com), which
comes
> with a fully integrated version of Apache (you knew that you need a web
> server to run CGI scripts, yes?). There simply is no comparison between
> Apache and IIS/PWS. This also takes the first-timer trauma out of getting
> an Apache/mod_perl/Perl installation going properly.
>
> I also recommend you get a copy of _Learning Perl on Win32 Systems_ by
> Schwartz, Olson and Christiansen. Also, _Programming Perl_ (the Camel) and
> _The Perl Cookbook_. Make sure to get a 3rd edition Camel (which covers
> version 5.6).
>
> HTH, and good luck
>
> Cheers,
> Damian
> --
> $;=ord$%,$:=$;-ord q,.,,$_=q
13346:3366:3276:3326:3386:546:566:966:3396:3376:1.
> q
73386:546:;96:3326:3336:3386:3266:3236:3366:546::26:3236:3366:32:6:546:32667
 .
>
q,:;96:;;6:3296:3236:3366:326:56,,s,.,;ord($&)-$:-$;;;;;,eg,s,$;,;chr$&-$:;,
eg,
> eval eval;               #requires 5.6.0 ## my first attempt at one of
these...




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

Date: Fri, 09 Feb 2001 15:22:27 GMT
From: neutron16@my-deja.com
Subject: howto split without regard to white spaces?
Message-Id: <9611v5$1bj$1@nnrp1.deja.com>

hi perl gurus, i wish to split a string of numbers i have into an array.
but it doesn't work with the following code:

#!/usr/local/bin/perl
$a = "    4822    1.174920e+02    6.944940e+01    4.633870e+00 ";
@b = split (/[\s]/, $a);
print "$b[0] $b[1] $b[2] $b[3]\n";

array @b contains only white soaces when i print it out! can anyone help
me out? thanks in advance!




Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 09 Feb 2001 15:44:34 GMT
From: mintcake@my-deja.com
Subject: Re: howto split without regard to white spaces?
Message-Id: <96138v$2kl$1@nnrp1.deja.com>

Don't put the \s in a character class [\s].  It achieves nothing (it
means 'any single character in the set made up of the sigle characater
\s' i.e. \s.  The meta \s matches a single whitespace character - for a
whitespace sequence use \s+

Use: split(/\s+/, $a)

In article <9611v5$1bj$1@nnrp1.deja.com>,
  neutron16@my-deja.com wrote:
> hi perl gurus, i wish to split a string of numbers i have into an
array.
> but it doesn't work with the following code:
>
> #!/usr/local/bin/perl
> $a = "    4822    1.174920e+02    6.944940e+01    4.633870e+00 ";
> @b = split (/[\s]/, $a);
> print "$b[0] $b[1] $b[2] $b[3]\n";
>
> array @b contains only white soaces when i print it out! can anyone
help
> me out? thanks in advance!
>
> Sent via Deja.com
> http://www.deja.com/
>


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 09 Feb 2001 10:47:55 -0500
From: John Kitchin <jkitchin@udel.edu>
Subject: Re: Net::FTP error - timeout on put()
Message-Id: <3A84112B.81B92F5B@udel.edu>

Have you tried setting the Timeout to longer?  check man Net::FTP, it
lists the default timeout at 2 minutes.
Maybe something like:
$ftp = Net::FTP-> new ("some.host.name" , Timeout =>10000)
would fix it.

j




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

Date: 09 Feb 2001 09:54:30 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Partial Apology to Perl Fans
Message-Id: <m3bssbq53t.fsf@mumonkan.sunstarsys.com>

topmind@technologist.com writes:

[...]

> But, if anybody says that "Perl is for everyone", then I *will* take
> objection. That is crossing the line. Unless, of course, objective
> metrics can be provided.
> 
> In summary, I hope everybody can learn from my mistake and not over-
> extrapolate their own preferences onto everybody else. Viva La
> Difference! (Is my french better than my Perl?)

Perhaps.

-- 
Joe Schaefer    "He can compress the most words into the smallest idea of any
                                         man I know."
                                                -- Abraham Lincoln


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

Date: Fri, 09 Feb 2001 14:39:25 GMT
From: cr639891-a <cote71@home.com>
Subject: Re: reading config file with do
Message-Id: <3A840168.4D49C462@home.com>

Ala Qumsieh wrote:
> 
> tjc <cote71@home.com> writes:
> 
> > #!/usr/local/bin/perl -w
> > my ($t);                          # This line is different.
> >
> > $t = 0; snarfle (); print "t = $t\n";
> > sub snarfle { do 'bar' }
> >
> > To my surprise it also printed out 1 and not 0.
> 
> No. This prints 0 for me. What version of Perl are you using?
> I'm using 5.6.0.
> 
> --Ala

I'm using perl 5.005_03 built locally on solaris 7.
I tried this on a different Solaris 7 box running 5.005_03 that
was prepackaged from sunfreeware.com and it prints 0.
I also tried a 5.005_02 on a different Solaris 7 box and it
also prints out 0.  It looks like there is something wrong with
my locally built 5.005_03.

tim


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

Date: Fri, 9 Feb 2001 10:19:48 -0500
From: "Philip Obbard" <pobbard@hotresponse.com>
Subject: Re: sending attachments
Message-Id: <9611gh$1mr$1@taliesin.netcom.net.uk>

I'm sure there is a good module out there. We use a small script by 'Eryq'
called mimesend.pl which allows attachments, HTML, etc., and can be called
in a single line. It can even (optionally) delete attachments once you've
sent them.

If you'd like a copy, I'd be glad to forward one on.

--Philip

"Troy Boy" <troyr@vicnet.net.au> wrote in message
news:jOHg6.146$FU5.4421@ozemail.com.au...
> Hi there,
>             What module can be used for sending mail attachments?
>
> Does anyone have a pointer to a perldoc i can look at (which explains
adding
> attachments not just sending plain text messages) or an example?
>
> Cheers
>
> --
> ----------------------------------------------------------------
> Troy Rasiah
> Melbourne, Aus
>
>




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

Date: Fri, 09 Feb 2001 15:40:04 GMT
From: jgunnip@my-deja.com
Subject: Sending email from Perl Script on NT
Message-Id: <96130h$2fq$1@nnrp1.deja.com>



Hi,

Does anyone know why the following code to send email works perfectly
on Linux but not on Windows NT?  It doesn't complain (i.e. die()) when
I use it on NT.  I just never receive the email.

Thanks,
Jon

email('foo@bar.com', 'bar@foo.com', 'Hello', 'Just saying Hi!');

sub email {
  use LWP::UserAgent;
  use HTTP::Request;

  my $to       = shift;
  my $from     = shift;
  my $subject  = shift;
  my $message  = shift or die 'Usage email($to, $from, $sub, $msg)';

  # mail message
  my $ua = LWP::UserAgent->new or die "$!";
  my $req = HTTP::Request->new(POST => "mailto:$to") or die "$!";
  $req->header(Subject => "$subject", From => $from);
  $req->content($message);

  $ua->request($req) or die "Error sending mail";
}



Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 09 Feb 2001 15:11:31 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Specifying the length of regular expression
Message-Id: <t88253lulv9uf1@corp.supernews.com>

In article <960ji8$l4t$1@nnrp1.deja.com>,
    Ian Boreham  <iboreham@my-deja.com> wrote:

: In article <960h6i$jeo$1@nnrp1.deja.com>,
:   Ian Boreham <iboreham@my-deja.com> wrote:
: 
: > If you really need to do it with a single regex, try:
: >
: >   ^(?=[ABC]{10,})A+B*C+$
: >
: > or some variation to taste.
: 
: You don't need the comma after the "10".

Yes you do; the original spec was length greater than ten.

When matching strings from non-regular languages, I find that
verifying the match with additional checks, e.g.,

    if (/^(A+B*C+)$/ && length($1) > 10) { ... }

as Dominus wrote, makes for much clearer code than doing it all in the
regular expression.

Greg
-- 
A witty saying proves nothing.
    -- Voltaire


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

Date: Fri, 9 Feb 2001 09:58:55 -0500
From: "Eric" <eric.kort@vai.org>
Subject: Splitting a quote-comma delimitted string
Message-Id: <9610a2$2onv$1@msunews.cl.msu.edu>

How can I split the following without splitting on the comma inside quotes:

How,do,I,split,"this, string",?

I want:
How
do
I
split
this, string
?

but clearly just split /,/ doesn't work.

Thanks,
Eric




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

Date: Fri, 09 Feb 2001 15:05:16 GMT
From: trammell@bayazid.hypersloth.net (John Joseph Trammell)
Subject: Re: Splitting a quote-comma delimitted string
Message-Id: <slrn987vo3.5ar.trammell@bayazid.hypersloth.net>

On Fri, 9 Feb 2001 09:58:55 -0500, Eric <eric.kort@vai.org> wrote:
> How can I split the following without splitting on the comma inside quotes:
> 
> How,do,I,split,"this, string",?

You probably want the Text::CSV_XS module.



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

Date: Fri, 9 Feb 2001 10:17:24 -0500
From: "Philip Obbard" <pobbard@hotresponse.com>
Subject: Thank you!
Message-Id: <9611c1$1kd$1@taliesin.netcom.net.uk>

Hi all (Jakob, Bart, Tom, et al)

Thanks for your quick responses and detailed explanations. I think I get it!
I appreciate your help.

(I was just telling a coworker why I liked working with Perl for the last
year: because the community is, for lack of a better term, "so good"... now,
I'll go see if *I* can find some questions to answer).

thanks again,
Philip




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

Date: Fri, 09 Feb 2001 14:32:50 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: This is driving me nuts and I need a guru
Message-Id: <slrn987oj0.dkd.tadmc@tadmc26.august.net>

Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "David" == David H Adler <dha@panix6.panix.com> writes:
>
>David> As much as I respect Tad, I need to disagree slightly.
>
>Oh, now you've done it, you ignorant twit!  You dissed a friend of
>mine!  Someone I partied with on a boat for an *entire* 10 days in the
>Caribbean! 


Hey mon. Don't worry, be happy.

( though I noticed a precipitous dip in my happy curve
  coincident with the disembarkation. )


>(www.geekcruises.com)


My favorite parts were the conference sessions with folks 
famous in their fields (and I never check the return value 
from open() calls either).


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


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

Date: Fri, 09 Feb 2001 15:14:29 GMT
From: mintcake@my-deja.com
Subject: Re: This is driving me nuts and I need a guru
Message-Id: <9611g9$po$1@nnrp1.deja.com>

If the SQL shown is real then I cannot explain it but since it
obviously isn't...

You say that sql_execute is inherited and ends with a dbresults()
call.  Did you know that dbresults() is supposed to be called in a loop
until it reurns NO_MORE_RESULTS.  Otherwise, if there is more than one
result set then the next time you use the DB handle you get an error -
and I bet you can guess what the error is.

If your SQL contains more than one select statement (excluding those
that select into server variables etc.) then this is what will happen.


In article <2Sxf6.67348$B6.17690467@news1.rdc1.md.home.com>,
  "Tim Gaverth" <gaverth@home.com> wrote:
> Thanks Abigail, but what's the fix? The db queries are processing all
> results. Here's a sample of how I'm doing that:
> ---
> my $dbh = $self->{'dbh'}; #this is inherited
> my $query = (
>     "select fieldone, fieldtwo ",
>     "from db1..table1 ",
>     "where crit = value ",
>     );
> $self->dbcmd($dbh,$query) || return undef;
> $self->sql_execute($dbh) || return undef; #my sql_execute is
inherited and
> ends with a dbresults command
> my $results = [];
> while ( my $row = $dbh->dbnextrow(1) ) {
>     push (@$results, $row);
> }
> return $results;
>
> Any more thoughts?
>
> Abigail <abigail@foad.org> wrote in message
> news:slrn97srcg.6au.abigail@tsathoggua.rlyeh.net...


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 09 Feb 2001 14:50:36 GMT
From: tunneling@my-deja.com
Subject: Two dimensional arrays
Message-Id: <96103p$vfg$1@nnrp1.deja.com>

Do 2D arrays exist?
Here is what I want to do.

Starting with:
abcdefg
hijklmn
opqrstu

I would like to be able to store each character as if it were in a nXn
matrix, for this case [1,2] = b; [0,0] = a; etc.

Any suggestions?


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 09 Feb 2001 15:02:32 GMT
From: bits101010@my-deja.com
Subject: Re: Two dimensional arrays
Message-Id: <9610q1$4n$1@nnrp1.deja.com>

yes!

$array[0][0] = a;
$array[0][1] = b;

Winston.

In article <96103p$vfg$1@nnrp1.deja.com>,
  tunneling@my-deja.com wrote:
> Do 2D arrays exist?
> Here is what I want to do.
>
> Starting with:
> abcdefg
> hijklmn
> opqrstu
>
> I would like to be able to store each character as if it were in a nXn
> matrix, for this case [1,2] = b; [0,0] = a; etc.
>
> Any suggestions?
>
> Sent via Deja.com
> http://www.deja.com/
>


Sent via Deja.com
http://www.deja.com/


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

Date: 9 Feb 2001 15:31:02 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Two dimensional arrays
Message-Id: <slrn98839h.9td.damian@puma.qimr.edu.au>

Thus spake tunneling@my-deja.com on Fri, 09 Feb 2001 14:50:36 GMT:
>Do 2D arrays exist?

Well, as a mathematical concept, they certainly do. But believe you mean
"can they be implemented in Perl?".

>...
>I would like to be able to store each character as if it were in a nXn
>matrix, for this case [1,2] = b; [0,0] = a; etc.
>

As you will understand from reading the perlvar man page, Perl
arrays can only store scalar values. Fortunately, Perl implements
references as scalars, and you can take a reference to an array. 

This is documented in the following man pages:

	perlref
	perllol
	perldsc

A quick example is as follows:

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

my @twodee= ( [ qw(a b c d e f) ],
              [ qw(g h i j k l) ],
			  [ qw(m n o p q r) ] );
print $twodee[0]->[0], "\n"; #prints 'a'
print $twodee[1]->[4], "\n"; #prints 'k'
print $twodee[2]->[5], "\n"; #prints 'r'
__END__

Hope this helps,
Cheers,
Damian
-- 
$;=ord$%,$:=$;-ord q,.,,$_=q 13346:3366:3276:3326:3386:546:566:966:3396:3376:1.
q 73386:546:;96:3326:3336:3386:3266:3236:3366:546::26:3236:3366:32:6:546:32667.
q,:;96:;;6:3296:3236:3366:326:56,,s,.,;ord($&)-$:-$;;;;;,eg,s,$;,;chr$&-$:;,eg,
eval eval;               #requires 5.6.0 ## my first attempt at one of these...


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

Date: Fri, 09 Feb 2001 14:16:10 GMT
From: Gordon.Haverland@agric.gov.ab.ca
Subject: Re: Using regex to match numbers (not digits)?
Message-Id: <3a83fa93.169568248@news.gov.ab.ca>

On Thu, 08 Feb 2001 22:30:55 GMT, nukes666@my-deja.com wrote:

>I apologize if this question is elementary, which I suspect it is.
>However, I am struggling with it and have searched the web and also
>checked the regex section of Learning Perl.
>
>I need to search a file which has, let's say, 2000 numbers in it
>between 1 & 2000, each on it's own line. I want to only print numbers
>700 through 900 and 1200 through 1500.
>
>I need something which would do something that in my "mind" might look
>like this:
>
>while (<FILE>) {
>      print if /[700-900][1200-1500]/;
>      }

break it into 2 problems, a 3 digit match (all by itself on a line),
and a 4 digit match (all by itself on a line).  
while( $line = <FILE> ) {
    chomp( $line );  # get rid of \n
    $line =~ s/^\s+//;  $line =~ s/\s+$//;  # white space
    print "$line\n"
     if( $line =~ /^[78][0-9][0-9]$/ || $line eq '900' );
 ...




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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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


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