[7130] in Perl-Users-Digest
Perl-Users Digest, Issue: 755 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 23 03:37:31 1997
Date: Wed, 23 Jul 97 00:00:53 -0700
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, 23 Jul 1997 Volume: 8 Number: 755
Today's topics:
'case' like statements, is it SWITCH? (Pui Ming WONG)
Re: //o and backreferences (Even Holen)
Re: //o and backreferences (Ilya Zakharevich)
?: stupid script call q (Brad Johnson)
Re: ??- Formatting output for sendmail <rootbeer@teleport.com>
Re: Arrays and Refs - is this a feature ? (M.J.T. Guy)
asynchronous processing using Perl and Sybperl <falkenl@context.com>
Re: Benchmarking Perl Compile Times <sfairey@adc.metrica.co.uk>
Re: Can't match = (Eric Bohlman)
CGI and SSI using PERL5 <mw@cavmicro.com>
Re: cgi perl <p.luca@macronet.it>
Functions as Parameters <jcp@mail.EUnot.pt>
Re: generate e-mail with MIME .dat file <rootbeer@teleport.com>
GET FREE 2100 $ex-Web $Sites FREE! @? houu88d77@compuserve.com
Re: GGAAAAKK!! Bad Perl week - now DBD Oracle troubles (John D Groenveld)
Re: How to call a package/method from a variable? (M.J.T. Guy)
How? call perl-subs from C++ with object-references. (Lars Dahlof)
Re: Learning Perl ..Help?? (Kevin Connery)
Re: Looking for a routine to trim white space (like VB <rootbeer@teleport.com>
Re: Merging large complex data structures--answers... <rootbeer@teleport.com>
Merging large complex data structures--try again... (Chris Sherman)
Re: Merging large complex data structures--try again... <rootbeer@teleport.com>
multicolumn output hughes@acsu.buffalo.edu
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Jul 1997 08:07:36 GMT
From: s11976@net2.hkbu.edu.hk (Pui Ming WONG)
Subject: 'case' like statements, is it SWITCH?
Message-Id: <5r1po8$cuu$1@power42t.hkbu.edu.hk>
I'm quite used to the using the 'case' ---> 'esac' statements
in writing my shell scripts.
Now i would like such similar statements in perl. I read the
manual and the 'switch' statments look like it. BUT, the examples
i saw have 'if's using together with the switch', which i think
to myself, then why not just use ifs.
Is 'switch' really the 'case' equivalents . If so, what should it
be like in perl.
If not, what other semantics will do the 'case' like branches under perl?
--
__
/ \_/ ) __ Pui Ming WONG (E-mail: pm@hkbu.edu.hk)
/ ( ------------- } System Support Programmer
( =l=ll===============__} Computing & Telecomm. Services Centre
\ _ ( Hong Kong Baptist University
\_/ \__) 224 Warerloo Road, Hong Kong
------------------------------
Date: 21 Jul 1997 12:33:16 GMT
From: evenh@ra.pvv.ntnu.no (Even Holen)
Subject: Re: //o and backreferences
Message-Id: <slrn5t6lob.sp6.evenh@ra.pvv.ntnu.no>
In article <mnot-ya02408000R2007971139210001@192.168.1.1>,
Mark Nottingham wrote:
>I'm doing a match inside of a loop, and would love to optimise it a bit
>with an 'o' on the end, but I'm using backreferences in the regex, like so
>( the \16 near the end):
>
>$line =~ /(\S+) (\S+) ([^\[\n]+) \[(\d+)\/(\w+)\/(\d+):(\d+):(\d+):(
>\d+) (\S+)\] "(\S+) (\S+) (\S+)" (\S+) (\S+)(?: ("?)(\S+)\16 "(.+)"|(\-))?/
>
>Can I safely stick an 'o' here, or will it then lock that reference as the
>match of the first loop?
Have you consider another solution to how to solve your problem? First
of all you uses a lot of grouping here, and secondly you (in the code
you have showed us) only use \16...
My suggestion is to try using split, something like
split(/[ \t\n"]*/, $line) seems to do the trick. And then rather do
some extra stuff stripping characters from some of the fields.
Alternatively try reducing the number of parentheses if you don't need
them. It might also be faster to make several regexps matching smaller
pieces of the string in addition to locking the regexps on line starts
and line ends...
I think it my be worthwhile to check out split in this occasion... :)
Regards,
Even Holen
--
<>< Even Holen, evenh@pvv.ntnu.no, http://www.pvv.ntnu.no/~evenh/ :-)
------------------------------
Date: 22 Jul 1997 00:25:55 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: //o and backreferences
Message-Id: <5r0umj$b2b@agate.berkeley.edu>
In article <mnot-ya02408000R2207970822130001@192.168.1.1>,
Mark Nottingham <mnot@pobox.com> wrote:
> I think my problem was that I didn't fully understand the doco regarding
> /o... and Tom made an excellent suggestion to speed things up by anchoring
> the beginning and end of the expression (which I haven't implemented yet,
> but I expect to speed things up nicely).
Note that an anchor at the end will not speed up your RE (unless you
applied the jumbo RE patch, _and_ your RE is very special - has the
"best" constant substring being at the end).
Ilya
------------------------------
Date: 21 Jul 97 19:28:21 GMT
From: bgjohnso@unix.amherst.edu (Brad Johnson)
Subject: ?: stupid script call q
Message-Id: <33d3b855.0@amhnt2.amherst.edu>
i'm probably taking a mind-numbingly wrong tack at
this problem in the first place, but here goes:
I've got a script that takes one argument, the
name of a database field, e.g. "People to Know"
or "Things to Do" as such:
perl archiver_go.pl "People to Know"
I want to call it from another script and send
its output to some other file. I try
(with full path names)
$cmd = "perl archiver_go.pl";
system $cmd \"$cats[$i]\" > $output;
where @cats is a list of the fieldnames
(w/o double quotes) and $output
is the pathname of the output file.
For some reason, archiver_go.pl only takes the
first word of the category name when I direct
the output to a file.
In other words,
system perl archiver_go.pl \"$cats[$i]\"
produces the correct output, but
when I direct the output, it doesn't...
Should I be setting STDOUT around the system call?
Should I not be using system here at all?
Thanks.
--bradj.
------------------------Nullus Oppidenda Est--------------------------
brad johnson (bgjohnso@unix.amherst.edu) 'Disc, God, Country, Pork'
http://www.amherst.edu/~bgjohnso/ 'Chickens! No Cynics!'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
------------------------------
Date: Mon, 21 Jul 1997 12:35:50 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Lindsay Adams <lnzadams@slip.net>
Subject: Re: ??- Formatting output for sendmail
Message-Id: <Pine.GSO.3.96.970721123331.7819G-100000@kelly.teleport.com>
On Mon, 21 Jul 1997, Lindsay Adams wrote:
> This may be slightly Off subject but if anyone knows how to format the
> output to sendmail so that I can send it as an attached file instead of
> as the body of the email, I would be most appreciative.
Lots of people know about sendmail and what it can do. They hang out in
comp.mail.sendmail. :-) Try looking there, and you'll be likely to get a
better and more complete answer than we could do for you here. (Hint: It's
probably in their FAQ.)
> Please reply to my email address as I rarely have time to scour the
> newsgroups these days.
But don't say that when you post there. That's like saying, "I'm not
really interested in the issues that are important to you people, and I
don't care if you've answered this question three times this week
already." I'm sure that you don't want to make a bad first impression.
Good luck with your project!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 21 Jul 1997 14:58:37 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Arrays and Refs - is this a feature ?
Message-Id: <5qvtet$9a1@lyra.csx.cam.ac.uk>
Helmut Jarausch <jarausch@numa1.igpm.rwth-aachen.de> wrote:
>Hi,
>
>I have come across the follow problem when using an array-element
>as '-variable' to a Radiobutton (pTk)
>
>use strict;
>
>use vars qw/ @T /;
>
>my ($T0,$T1)= (\$T[0],\$T[1]); # $T[0] doesn't seem to 'spring into existence'
Yes it does.
>@T=(1,1);
This replaces @T, and hence each $T[n], with a new array.
>obviously \$T[0] and \$T[1] are references to the Nirwana unless
>something has been assigned to $T[0] and $T[1].
To explore cases like this, it's usually helpful to print out the
references involved, so you can see which expression refers to what.
In particular, the "my" statement _has_ created two scalar values
associated with $T[0] and $T[1]. You could print $#T at this point and
see that it was equal to 1. And $T0, $T1 are references to these.
When you assign to @T as a whole, a new array of scalar values is created
and associated with $T[0] ... . This differs from assigning to the
elements of @T, i.e.
@T[0..$#T] = (1,1)
which simply updates the old scalar values.
Try
my ($a, $b) = (\$c[0], \$c[1]);
print "Original values for \$a, \$b $a $b\n";
@c[0..$#c] = (1,1);
print "\$c[0], \$c[1] refer to the same values ", \$c[0], ' ', \$c[1], "\n";
@c = (1,1);
print "\$a, \$b are unchanged $a $b\n";
print "but \$c[0], \$c[1] refer to new values ", \$c[0], ' ', \$c[1], "\n";
which gives output
Original values for $a, $b SCALAR(0xa8050) SCALAR(0xad380)
$c[0], $c[1] refer to the same values SCALAR(0xa8050) SCALAR(0xad380)
$a, $b are unchanged SCALAR(0xa8050) SCALAR(0xad380)
but $c[0], $c[1] refer to new values SCALAR(0xad374) SCALAR(0xad308)
Mike Guy
------------------------------
Date: 21 Jul 1997 21:54:59 GMT
From: "Lee Falkenhagen" <falkenl@context.com>
Subject: asynchronous processing using Perl and Sybperl
Message-Id: <01bc9620$67d58e60$f90d5093@GUEST.dhs.state.tx.us>
I need to do some asynchronous processing using Perl and sybPerl. Any
ideas on how to do this using Perl 4.036 and Sybperl 1.9? I have a SMP
machine and right now, Sybase is only processing one request at a time. I
would like to give the other CPUs some work to do.
It would require kicking off several functions that I wrote that are the
basis for other work. When these functions are finished, several other
dependent functions then need to be called for each of the first functions.
I can not include the calls in the original function because the business
rules will change over time and the dependent functions are only called in
certain circumstances.
Thanks
--
Lee Falkenhagen
Certified Sybase DBA
falkenl@crl.com
------------------------------
Date: Mon, 21 Jul 1997 10:31:04 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: bkyan@mindcast.com
Subject: Re: Benchmarking Perl Compile Times
Message-Id: <33D32C57.8D2A490B@adc.metrica.co.uk>
Benjamin Kyan wrote:
> Hi,
>
> Anyone know of a *quick* way to benchmark a script, including
> compile times? I think the Benchmark module ignores compile
> times...
>
> I've a CGI script that's getting pretty long, and am looking for
> a mean to benchmark it to see how much different using the
> SelfLoader module makes...
>
> Thanks!
>
> --
>
> Best Regards,
> Benjamin Kyan
> bkyan@mindcast.com
>
> ========================== ======================== ==============
> Clickstream Communications 9101 W. Sahara, #105-183 T 404.685.0852
> (website) www.mindcast.com Las Vegas, Nevada 89117 F 404.685.0853
> ========================== ======================== ==============
I am not sure if it is exactly what you want but try looking at the
Profiler Module in the Development section at your local CPAN.
Simon
------------------------------
Date: Wed, 23 Jul 1997 01:27:35 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Can't match =
Message-Id: <ebohlmanEDr01z.Av5@netcom.com>
Roberto L. Dorich (rdorich@allegro.cs.tufts.edu) wrote:
: I'm trying to process all the lines in a file with the following format:
:
: SOME_ID = some_num,
: ^--- the , is optional.
:
: So I do:
:
: while ($line = <file>)
: {
: next if ($line =~ /\w+\b*=/);
Two problems here, a big one and a little one. The little one is that
"\b" doesn't mean "a blank"; it means "a word boundary." You want "\s"
which matches "whitespace." The big problem is that this regex (with
the \b problem fixed) matches exactly the lines you want to process, yet
if it matches, you *skip* the line! You've got your logic reversed.
:
: process($line);
: }
May I suggest reading perlre and perlsyn? They should do a good job of
clearing up the sort of confusion that caused these problems. Can you
think of any other language that comes with as much absolutely *free*
documentation as Perl does?
------------------------------
Date: Tue, 22 Jul 1997 19:21:08 -0400
From: "M.Wright" <mw@cavmicro.com>
Subject: CGI and SSI using PERL5
Message-Id: <33D54064.7B4E@cavmicro.com>
Does anyone know of any problems with using cookies with SSI? I know I
can't set cookies with ssi, but why can't I read them? I am using perl5
scripts called from a form to set three cookies, and I want to read them
back with a script called from a server side include exec command.
Although I can read the cookies fine using URL or form called scripts,
nothing for the SSI scripts, even if they are the same script!
Please help me!
Mike Wright
mpwright@esinet.net
------------------------------
Date: Sat, 19 Jul 1997 20:05:08 +0200
From: "Luca" <p.luca@macronet.it>
Subject: Re: cgi perl
Message-Id: <5r08cm$9cn$1@news.flashnet.it>
>I was going to write out an answer telling how to do it, but I've
changed
>my mind: The potential security problems are so great that, if you need
to
>ask, you should really get somebody else to do the job. I apologize if
>this sounds harsh, but you really can't afford to have bugs and security
>holes in a script which is editing your user database. This is like
trying
>to build your own bank vault, and that's not a do-it-yourself project
>either.
I thought it took a simple script to do that, and howevere if you write me
the script
I will able to chek it before use it. Was it your problem or I missed
understood your answer?
>If you'd like to hire a contract programmer who could do this job right,
I
>could recommend somebody. :-) Or, you can wait until the User::pwent
>module is finished. Since that should provide a good and safe interface
to
>the password database, you'll be able to write a simple program to do
what
>you want with fewer chances of something going wrong. (I don't know when
>that module will be finished, if ever.)
Where can I find this module and Who is writing it?
Thank you again your kindness.
------------------------------
Date: Mon, 21 Jul 1997 16:19:36 +0100
From: Jose4 Carlos Oliveira Pereira <jcp@mail.EUnot.pt>
Subject: Functions as Parameters
Message-Id: <33D37E08.77B3BDA0@mail.EUnot.pt>
Hi there
Could someone please give me a hand with the following:
I need to pass a funcion as a parameter to another. I use this
quite frequentely, but the funcions I normaly use are defined
in the same package. ie,
package XPTO
sub parameter{
...
}
sub receiver{
my $ref = shift(@_);
&$ref;
}
&receiver(\¶meter);
This works alright, but when the parameter is in another package,
package FOOBAR
sub parameter{...}
package XPTO
require FOOBAR;
receiver(\&FOOBAR::parameter)
This gets me the error:
"Not a CODE reference at
(line in &receiver where I try invoking the parameter)
What am I doing wrong?
thanks
--
Ze' Carlos
<ESC>:x
To reply, please change EUnot to EUnet in my address
Para responder, e' favor mudar o EUnot para EUnet no meu endereco
------------------------------
Date: Mon, 21 Jul 1997 21:45:32 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ariel Y Fishman <ayfishma@mail2.sas.upenn.edu>
Subject: Re: generate e-mail with MIME .dat file
Message-Id: <Pine.GSO.3.96.970721213741.24293E-100000@kelly.teleport.com>
On 21 Jul 1997, Ariel Y Fishman wrote:
> I am trying to write a CGI perl script that will turn form submissions
> into an e-mail with a MIME attachment containing the form data as a
> tab-delimited spreadsheet. I'm not having much luck, however. I've been
> trying just to generate the e-mail in a perl script, send it using
> sendmail, and make it look like there is an attachment present, but it
> doesn't seem to work (it reads the e-mail message literally, and not as
> an attachment.)
When you're using Perl to interact with an external program and you can't
get the external program to do what you want, the key is to examine
exactly what you're telling the external program to do. For example, if
you're opening a pipe to sendmail and printing to it, try changing the
open to put the data into some file so you can see what you've got. Then,
you can send that same data on to sendmail (say, from the shell) and see
what it does.
If you can't get Perl to print the stuff you want, that's a question that
we might be able to help with here. If you can print the stuff you want,
but you still can't get the other program to work, that's a question for
the sendmail experts (or whoever knows about the other program) because at
that point the Perl code is just fine.
In this case, it sounds like you don't have a problem with Perl. If you're
having troubles with sendmail, there's a sendmail newsgroup whose members
(or FAQ) may be able to give you a better or more complete answer than you
can find here. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 21 Jul 1997 21:53:36 GMT
From: houu88d77@compuserve.com
Subject: GET FREE 2100 $ex-Web $Sites FREE! @?
Message-Id: <5r0lp0$30p@news1-alterdial.uu.net>
This is a multi-part message in MIME format.
--_-=772
Content-type: text/html; name="Sex~1.htm"
Content-transfer-encoding: base64
PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9JRVRGLy9EVEQgSFRNTC8vRU4iPg0KDQo8aHRt
bD4NCg0KPGhlYWQ+DQo8dGl0bGU+U0VDUkVUIFBBU1NXT1JEIEZPUiBBRFVMVCBTSUdIVFM8
L3RpdGxlPg0KPG1ldGEgbmFtZT0iR0VORVJBVE9SIiBjb250ZW50PSJNaWNyb3NvZnQgRnJv
bnRQYWdlIDEuMSI+DQo8L2hlYWQ+DQoNCjxib2R5IGJnY29sb3I9IiNDMEMwQzAiIHRleHQ9
IiM4MEZGRkYiIGxpbms9IiMwMDAwRkYiIHZsaW5rPSIjMDAwMEZGIiBhbGluaz0iI0ZGMDAw
MCI+DQo8ZGl2IGFsaWduPWNlbnRlcj48Y2VudGVyPg0KPHRhYmxlIGJvcmRlcj01IGNlbGxw
YWRkaW5nPTI+DQo8dHI+PHRkIGFsaWduPWNlbnRlciB3aWR0aD0xMDAlPjxmb250IGNvbG9y
PSIjRkZGRjAwIj48Zm9udCBzaXplPTc+PGI+RlJFRSEgRlJFRSEgRlJFRSE8YnI+DQo8L2I+
PC9mb250PjwvZm9udD48Zm9udCBjb2xvcj0iI0ZGMDAwMCI+PGZvbnQgc2l6ZT01PjxiPlRI
QVQnUyBSSUdIVC4uLiBDT01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vcj0iI0ZGMDA4MCI+PGZvbnQgc2l6ZT03PjxzdHJvbmc+Qk9OVVMhISE8
YnI+DQo8L3N0cm9uZz48L2ZvbnQ+PGZvbnQgc2l6ZT01PjxzdHJvbmc+RlJFRSBYWFggQ2hh
dCBSb29tcyEhITwvc3Ryb25nPjwvZm9udD48L2ZvbnQ+PC9wPg0KPHAgYWxpZ249Y2VudGVy
PjxhIGhyZWY9Imh0dHA6Ly8yMDUuMjE2LjI0OS4xOC9jZ2ktc2hsL2RibWwuZXhlP3RlbXBs
YXRlPS9hcy9zaWdudXAuZGJtJmFtcDtzaXRlPXN0MzUzMjUiPjxmb250IGNvbG9yPSIjODAw
MDgwIj48Zm9udCBzaXplPTY+PHN0cm9uZz5JIFdBTlQgVEhFIFBBU1NXT1JEIE5PVzwvc3Ry
b25nPjwvZm9udD48L2ZvbnQ+PC9hPjwvcD4NCjwvYm9keT4NCg0KPC9odG1sPg0K
--_-=772
------------------------------
Date: 21 Jul 1997 10:52:22 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: GGAAAAKK!! Bad Perl week - now DBD Oracle troubles
Message-Id: <5qvt36$adf$1@tholian.cse.psu.edu>
Asked and answered on the DBI-Users maillist. The list is referenced in
the README and the archive is at
http://outside.organic.com/mail-archives/dbi-users/
http://www.rosat.mpe-garching.mpg.de/mailing-lists/PerlDB-Interest/
perl Makefile.PL -p worked for me.
Happy Perl'ng
John
groenvel@cse.psu.edu
------------------------------
Date: 22 Jul 1997 14:11:32 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: How to call a package/method from a variable?
Message-Id: <5r2f2k$51m@lyra.csx.cam.ac.uk>
Ruben Schattevoy <schattev@imb-jena.de> wrote:
>Hi,
>
>I want to use something like this:
>
>require "DIR/$package.pm";
>$object = DIR::$package->new();
Try
$object = "DIR::$package"->new();
The lhs of -> is an expression which evaluates to either an object reference
or to a string which is a package name.
Note also that if you wish to parametrise DIR as well, you'll need some
extra {}:
$object = "${dir}::$package"->new();
Mike Guy
------------------------------
Date: 22 Jul 1997 17:08:21 GMT
From: uabdahl@uab.ericsson.se (Lars Dahlof)
Subject: How? call perl-subs from C++ with object-references.
Message-Id: <5r2pe5$s5c$1@uabs64.uab.ericsson.se>
Keywords: callback perl c++
Hi!
I'm working with a perl-interface (perl, v4) for API libraries written in C++.
I am using swig1.1 to create the modules.
The big problem is that I want to use callback functions in C++ that
calls functions in perl (sub) with a reference to an object created in
C++ as an input argument.
I have embeded perl and it is no problem to call the perl subs with callback
functions in C++ with input arguments as integers, doubles, hashes or arrays.
The thing that I think that I need :) is a pointer to the created object
in C++ that is blessed to a STASH object in Perl in some way so that
the given argument in the sub is in the format (*) (for example):
sub tst::subroutine
{
($ref) = @_;
print "$ref"; -> Str=HASH(0x23232) (*)
print $ref->test (); -> "Segmentation fault"
}
where Str is a class in C++ and a shadow-class in Perl5.
class Str
{
public:
Str () {
data = 99;
}
void
test () {
cout << data << endl;
};
int data;
};
I want to access the object created in C++ as an input parameter like
$ref->test () without geting a "Segmentation fault".
I have written some PSEUDO code below but it does not use the adress
to the str object created, and only to a new hash-table. How can I
modify it so that it is pointing at "Str *str = new Str ()" instead?
class Hash
{
public:
Hash () {
};
void
hash_stuff () {
dSP;
HV *hv = newHV ();
HV *obj = newHV ();
char *key;
I32 klen;
Str *str = new Str ();
dat = (long)str;
hv_store (hv, "data", 4, newSViv (99), FALSE);
ENTER;
SAVETMPS;
PUSHMARK(sp);
XPUSHs(sv_bless (newRV ((SV*)hv), gv_stashpv ("Str", FALSE)));
PUTBACK;
perl_call_pv("tst::subroutine", G_SCALAR | G_EVAL);
(void)hv_iterinit(hv);
while ((val = hv_iternextsv(hv, &key, &klen)))
printf("in C: %s=`%s'\n", key, SvPV(val,na));
if (SvTRUE(GvSV(errgv)))
fprintf(stderr, "eval error: %s\n", SvPVx(GvSV(errgv), na));
FREETMPS;
LEAVE;
/* now release hv */
hv_undef(hv);
SvREFCNT_dec((SV*)hv);
};
};
I have read a lot of documentation including for example (perlcall,
perlembed......) but I do not understand how to fix it.
------------------------------
Date: 21 Jul 1997 15:53:25 GMT
From: Keradwc@cris.com (Kevin Connery)
Subject: Re: Learning Perl ..Help??
Message-Id: <5r00ll$t75@chronicle.concentric.net>
In article <5qlhe6$pv7@mimsy.cs.umd.edu>, Charles Lin <clin@cs.umd.edu> wrote:
>Boris Tabenkin (bat@unifi.com) wrote:
> Which PERL book is that? There are two by O'Reilly (publishing).
> I'll tell you the reason I had difficulties initially with Programming
>Perl. Although I already knew C and C++, I had never really done any
>shell programming, nor awk or sed. That hindered me in one way:
>I didn't really understand the philosophy of shell programming. Shell
>programming is useful for certain kinds of problems, primarily those
>dealing with file processing and output processing (which can be thought
>of as file processing).
>
> As I recall, Programming Perl has a rather cavalier writing style
>(perhaps an exaggeration), as the author(s) try to tell you neat things
>about the language. I usually go in with the mindset that I am trying
>to learn how to program the language in the first chapter, not "look
>at what this language can do for me". Perhaps that's the wrong
>way to approach that chapter. Anyway, such notions as associative
>arrays were somewhat foreign to me. While I was being shown its *use*,
>I wanted a more formalized description of what an associative array
>was, what syntax to use, and so forth. I was frustrated at the informal
>approach in the first chapter because I wasn't getting a real understanding
>of how to write code.
I'll strongly bet that you used the original Programming Perl book, which,
for a number of years was the _only_ available printed reference to the
language.
The new one, the 'teal' Camel, is vastly improved; it's been consolidated
into a cleaner reference, is a lot more useful as a learning tool, etc.
(That's from new-to-perl people, not just me reading it after using
perl for 5 years.)
LEARNING PERL is a great way to access the core of Perl's power.
PROGRAMMING PERL, the new version, gives the rest of the details about
what Perl can do, though never enough examples. Other texts appear to
give more examples, but often at the expense of core details. (I have
hopes for the upcoming EFFECTIVE PERL (or is it EFFICIENT?), but that's
based on reviews, not experience.)
They're both SAFE choices. For an individual, another one might be better,
but, overall, most of the rest of the Perl books aren't as "strong".
In my opinion, of course.
--kdc
> Now, I will say that some of these "learn in blah days" books aren't
>always very good. Sometimes the authors mistake "hip talk" and using
>"cute examples" for really explaining the subject. To cite a different
>example, I'm looking at "Apache: The Definitive Guide" which is another
>O'Reilly book. I find this very frustrating to read. Now, partly,
>I'm a slow learner when it comes to technical books, but partly, I think
>it doesn't do a good job of explaining things. The fortunate thing is
>that there is a lot of stuff in the book that is useful, but it takes
>a while to understand it. Unfortunately, this appears to be one of
>two books on Apache, and the Apache web site really has a bad excuse
>for a FAQ, not to mention no tutorials, but that's a side gripe.
>
> This is why I find it interesting when someone asks "Can someone
>recommend a good book on blah....?". The answer is "it depends on
>what you like to read". For example, in C++, some people want the
>original Stroustrup book. Others want a "Who's Afraid of C++?"
>(this is a book where the author talk to a novice, and there is
>a back and forth exchange as she gets confused, and he gives her
>answers to clear things up). Still others might be happy with
>some ANSI draft, "formal" spec of the language. There's often a
>tradeoff between ease of reading, and completeness, as well as
>accuracy. I think we should all be happy that learn blah in N
>days books exist. It makes computers accessible to a much wider
>population rather than to a narrow group of bright programmers who
>can read between the lines, and toy around with the language, using
>their previous experience to help out. Not everyone fits in that
>category.
>
>--
>Charles Lin
>clin@cs.umd.edu
>
------------------------------
Date: Mon, 21 Jul 1997 07:12:07 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Steve O'Hara Smith <sohara@mardil.elsevier.nl>
Subject: Re: Looking for a routine to trim white space (like VB trim$)
Message-Id: <Pine.GSO.3.96.970721070554.19811D-100000@kelly.teleport.com>
On 21 Jul 1997, Steve O'Hara Smith wrote:
> Newsgroups: comp.lang.perl.misc, comp.lang.perl
If your news administrator still carries comp.lang.perl, please encourage
him or her to check out the frequent posting about bogus newsgroup names
in news.announce.newgroups. You'll be doing yourself and many others a
favor to use only comp.lang.perl.misc (and other valid Perl newsgroups)
instead.
news:news.announce.newgroups
> Subject: Re: Looking for a routine to trim white space (like VB trim$)
> Try
>
> ($stripped) = $unstripped =~ /^\s*(\S.*\S)\s*$/;
This doesn't strip whitespace from strings with only zero or one
non-whitespace character. Fortunately, one correct answer is covered in
the FAQ, since this is among the most F of FAQs. But thanks for trying!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 21 Jul 1997 18:29:13 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Chris Sherman <sherman@unx.sas.com>
Subject: Re: Merging large complex data structures--answers...
Message-Id: <Pine.GSO.3.96.970721182320.6975I-100000@kelly.teleport.com>
On Mon, 21 Jul 1997, Chris Sherman wrote:
> One method is to:
>
> %TV = (%TV1, %TV2);
>
> The second method is to:
>
> @TV1{ keys %TV2 } = values %TV2;
>
> which merges %TV2 into %TV1. I was warned that the second
> method copies only references, but not the data itself.
True, but to be sure, the first method does the same thing. :-)
Neither one of those methods will duplicate the internals of complex data
structures. What this means (for the benefit of anyone trying to follow
along at home) is that if one value of %TV2 is a reference to an array,
the new (or enlarged) hash will have a reference to the _same_ array,
rather than a reference to a copy. Another way to say that is that it uses
a copy of the reference, instead of a copy of the thing the reference
points to. Depending upon the application, this may be what you want,
though.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 21 Jul 1997 15:24:55 GMT
From: sherman@unx.sas.com (Chris Sherman)
Subject: Merging large complex data structures--try again...
Message-Id: <EDoDHJ.2uD@unx.sas.com>
[Did the previous post get out??? Or was it just too simple? :-)
Let me try again...]
I want to merge two complex data structures into a new variable.
For instance (from the book):
%TV1 = (
flintstones => {
series => "flintstones",
nights => [ qw(monday thursday friday) ],
members => [
{ name => "fred", role => "lead", age 36,},
],
}
)
And suppose I had in a separate file somewhere:
%TV2 = (
jetsons => {
series => "jetsons",
nights => [ qw(wednesday saturday) ],
members => [
{ name => "george", role => "lead", age 41,},
],
}
)
Now, I want something called %TV, which is a merging of both
data structures from above.
So, in effect, I want to do:
%TV = %TV1 + %TV2; # thinking of '+' as a union operator
How can I do that? I just don't see the obvious solution,
other than manually stepping through both structures and setting
every element of the third by hand. There has to be a better way...
Thanx!!!
--
____/ / / __ / _ _/ ____/
/ / / / / / / Chris Sherman
/ ___ / _/ / /
_____/ __/ __/ __/ _\ _____/ _____/ sherman@unx.sas.com
------------------------------
Date: Mon, 21 Jul 1997 12:40:50 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Chris Sherman <sherman@unx.sas.com>
Subject: Re: Merging large complex data structures--try again...
Message-Id: <Pine.GSO.3.96.970721123636.7819H-100000@kelly.teleport.com>
On Mon, 21 Jul 1997, Chris Sherman wrote:
> I want to do:
>
> %TV = %TV1 + %TV2; # thinking of '+' as a union operator
One way to merge two hashes is to do this.
%TV = (%TV1, %TV2); # Combine them
If you want to add one hash's elements to the other, though, it may be
better to do this.
@TV1{ keys %TV2 } = values %TV2; # Merge %TV2 into %TV1
(Of course, if you have complex data structures, this will copy
references, not data. Depending upon your needs, this may be what you
want. If it's not, you may need to loop through the list of items.) Do
either of those methods do anything good for you? Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 21 Jul 1997 17:14:40 -0400
From: hughes@acsu.buffalo.edu
Subject: multicolumn output
Message-Id: <Pine.GSO.3.96.970721171301.27455A-100000@joxer.acsu.buffalo.edu>
How do I force multicolumn output? In shell there's a simple filter, but
is there something similar in Perl? Thanks in advance.
Frank
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 755
*************************************