[13855] in Perl-Users-Digest
Perl-Users Digest, Issue: 1265 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 3 12:05:45 1999
Date: Wed, 3 Nov 1999 09:05:17 -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: <941648716-v9-i1265@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 3 Nov 1999 Volume: 9 Number: 1265
Today's topics:
Re: "Argument" I don't understand. <rhomberg@ife.ee.ethz.ch>
"Argument" I don't understand <patrick@ocg6.marine.usf.edu>
Re: * Robust NEWS Application needed ASAP *** (David Cantrell)
Re: * Robust NEWS Application needed ASAP *** (John Stanley)
Re: * Robust NEWS Application needed ASAP *** (John Stanley)
[ANNOUNCE] Mac::Glue / Mac::AppleEvents::Simple Updated (Chris Nandor)
Re: Another 'or'? was [perl double-split] <bernie@fantasyfarm.com>
Re: Another 'or'? was [perl double-split] (Abigail)
Can I send SMS messages from Perl script? <marcl@xs4all.nl>
core dump - perl, me or server? <rhardicr@mail.ford.com>
Help Needed in Win32::API <Ismail_Mohideen@amsinc.com>
Re: Hiding Perl Scripts? <gellyfish@gellyfish.com>
Re: How can I set reg. expresion to anchor at the end o (Neko)
How do I prevent wildcard expansion on the command line <psteele@opticalnetworks.com>
Re: Is there a *wildcard that I can use to match text? patelni101480@my-deja.com
Re: Is there a *wildcard that I can use to match text? <rootbeer@redcat.com>
Re: Is there a *wildcard that I can use to match text? <rootbeer@redcat.com>
Limit of Win32::GetTickCount <schoedema@my-deja.com>
Re: Limit of Win32::GetTickCount <camerond@mail.uca.edu>
mirror command <bedesign@webspan.net>
Re: Need to remove url and keep file <rootbeer@redcat.com>
Perl and AIX v4.3.2 mgrabens@popd.isinet.com
Perl and commonsense part 2 ajmayo@my-deja.com
Re: Perl and commonsense part 2 <uri@sysarch.com>
Re: Perl and commonsense part 2 (brian d foy)
Re: Perl and commonsense part 2 <rhomberg@ife.ee.ethz.ch>
Re: Perl and commonsense part 2 (Bill Moseley)
Re: Perl and commonsense part 2 <jeffp@crusoe.net>
Re: Perl and commonsense part 2 <ltl@rgsun5.viasystems.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 03 Nov 1999 16:59:58 +0100
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: "Argument" I don't understand.
Message-Id: <38205BFE.B9415B86@ife.ee.ethz.ch>
Patrick Smith wrote:
> Argument "260.056 09-17-99 01:20:00 ..." isn't numeric in ncmp at line
> ...etc.
>
> This array as you can see has nothing but numbers in it. Any ideas as to
> why I am getting this Argument?
I can see that it has spaces, colons, dots and dashes, none of which I'd
consider part of a number (except a single dot)
If all your number fields are fixed length, you can do a string (==
standard) sort.
Otherwise, you either have to prepare the fields for a string sort or
you can sort the fields like described in the faq
- Alex
------------------------------
Date: Wed, 03 Nov 1999 11:00:40 -0500
From: Patrick Smith <patrick@ocg6.marine.usf.edu>
Subject: "Argument" I don't understand
Message-Id: <38205C28.31DF@ocg6.marine.usf.edu>
Hi,
I am using this little script to sort an array. I have included
a sample data set.
#/usr/sbin/perl5.003 -w
use diagnostics
#begin
#opens test data
open(IN, "/usr2/people/patrick/test4result.dat")
or die "Cannot open input: $!\n";
#applys data file to array
@data=<IN>;
close IN;
#sorts array of test data
@srtedarray = sort{(split/''/,$a)[0]<=>(split/''/,$b)[0]}@data;
#opens out file
open(OUT, ">/usr2/people/patrick/sorted_test4data.dat")
or die "Cannot open OUT: $!\n";
#prints sorted test array to file
print OUT "@sortedarray";
close OUT;
#end
It works just fine with the exception of the following argument for each
line of data.
Argument "260.056 09-17-99 01:20:00 ..." isn't numeric in ncmp at line
...etc.
This array as you can see has nothing but numbers in it. Any ideas as to
why I am getting this Argument?
260.056 09-17-99 01:20:00 0.00 0.30 347.90 -3.40 23.23
259.556 09-16-99 13:20:00 0.00 410.70 363.30 -3.90
29.26
269.598 09-26-99 14:21:00 0.00 51.40 385.90 -4.00
29.80
Oh, one other thing, in my output file using my real data set the
first line is all the way to the left margin, however the following
lines are indented by one space.
Why would this be happening?
Thanks in advance.
Patrick
------------------------------
Date: Wed, 03 Nov 1999 15:13:02 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: * Robust NEWS Application needed ASAP ***
Message-Id: <38205061.75560139@10.0.0.155>
On Tue, 02 Nov 1999 13:44:35 +0000, Mick Knutson
<mknutson@baselogic.com> said:
>I need a robust way to manage news on my web site.
>I have multiple columnists, and want to manage the news via a web page.
I am unaware of any commercially available content manglement systems
which I could recommend. I could write one for you in perl though. I
can't give you a firm quote without knowing more about your
requirements, but feel free to contact me and we can discuss the
details. FYI, my normal fee is approximately one hundred pounds
sterling per hour.
I hope this is more useful than some of the other responses you will
no doubt get here.
--
David Cantrell, part-time Unix/perl/SQL/java techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: 3 Nov 1999 16:49:22 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: * Robust NEWS Application needed ASAP ***
Message-Id: <7vpp2i$b15$1@news.NERO.NET>
In article <38202648_2@newsread3.dircon.co.uk>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>But most of 'us' would agree that this is probably not the place to be asking
>for prewritten code, most of 'us' think that this newsgroup is for the
>discussion of programming in Perl.
You are confused. This newsgroup is for the repetative autoposting of
rules describing how to format news articles, and tiny snippets of the
Perl FAQ where in most cases the header of the article and boilerplate
is larger than the actual answer, by someone who does not read the
group.
Whatever discussion takes place is incidental to that.
>The original poster would be better off somewhere else.
Probably.
------------------------------
Date: 3 Nov 1999 16:50:37 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: * Robust NEWS Application needed ASAP ***
Message-Id: <7vpp4t$b62$1@news.NERO.NET>
In article <pudge-0311990855040001@192.168.0.77>,
Chris Nandor <pudge@pobox.com> wrote:
>
>It was not tacky. It was the most appropriate response I can conceive of.
The latter does not imply the former.
------------------------------
Date: 3 Nov 1999 15:15:25 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: [ANNOUNCE] Mac::Glue / Mac::AppleEvents::Simple Updated
Message-Id: <7vpjid$420$1@play.inetarena.com>
MacPerl modules Mac::Glue 0.57 and Mac::AppleEvents::Simple 0.81 have been
released and are available now on CPAN.
http://search.cpan.org/search?dist=Mac-Glue
http://search.cpan.org/search?dist=Mac-AppleEvents-Simple
New in this release:
* In addition to addressing remote applications with server and zone,
Mac OS 9 users can now target applications with hostname or
IP address.
* Mac OS 9 support for creating "dialect" glue (dialect is now
merged with AppleScript extension).
* Returned records are now passed as hashrefs, with keys converted
from the four-char IDs to the proper class/property names.
* Support for class parameter in records.
* Other bugfixes.
For an overview of Mac::Glue:
http://pudge.net/macperl/Mac-Glue.html
Thanks,
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Wed, 03 Nov 1999 09:11:47 -0500
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: Another 'or'? was [perl double-split]
Message-Id: <2z8gOC+WEaeVGdOKN7uAKcSiXdqy@4ax.com>
bart.lateur@skynet.be (Bart Lateur) wrote:
} In fact: Perl is a rather dangerous language in this regards, because it
} makes it most easy to write rather buggy programs this way. The "||"
} construct is the most explicit example: nothing is more easy than to
} write:
}
} $_ = $data{text} || $data{caption};
}
} if some "object" (an item in a GUI) may have a "caption" property, or a
} "text" property, and both are, in fact, equivalent. But if the "caption"
} is the string "0", and the "text" doesn't exist, well, you get undef as
} a result. Yuck. And wrong.
}
} What will you do? Write:
}
} $_ = defined($data{text})?$data{text}:$data{caption});
}
} ? Yeah, right. I believe that. Not.
Well, I have to say that I write that code *all*the*time*. I hate it, it
is ugly, but that's what I do. With a longer perspective on things, this
is a pretty minor matter [among the thousands of things you have to do, as
a programmer, to make your systems really do the right thing that 0.1% of
the time "around the edges"], so I don't actually care much.
I actually agree, in part, with a remark that someone else made: Perl would
then have *four* 'or' operators [| || or ??] and all of a sudden you'll
have new [and *much* more subtle, IMO] bugs with folk picking the wrong
ones. I can only wonder, in the large, if this kind of
relatively-minor-improvement will, on balance, cause more bugs than it'll
cure....
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: 3 Nov 1999 10:26:20 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Another 'or'? was [perl double-split]
Message-Id: <slrn820og5.ls3.abigail@alexandra.delanet.com>
Bernie Cosell (bernie@fantasyfarm.com) wrote on MMCCLV September MCMXCIII
in <URL:news:2z8gOC+WEaeVGdOKN7uAKcSiXdqy@4ax.com>:
;;
;;
;; I actually agree, in part, with a remark that someone else made: Perl would
;; then have *four* 'or' operators [| || or ??] and all of a sudden you'll
;; have new [and *much* more subtle, IMO] bugs with folk picking the wrong
;; ones. I can only wonder, in the large, if this kind of
;; relatively-minor-improvement will, on balance, cause more bugs than it'll
;; cure....
The operators aren't the cause of the potential bugs. The differences
between defined and false are.
Not having a boolean type and a handful of "false" values is sometimes
convenient, but on the other hand, a royal pain in the ass.
The absence of `??' is a major one - and the fact it's being proposed
over and over again, even by people with enough tuits is proof enough
it would be a useful addition.
And so what that we have four operators that might be called "or"?
We have four looping constructs, (or 6, depending how you count)
as well, and noone complains about that.
Perl is supposed to be the programmers friend. Denying `??' with the
argument "it's not needed", isn't very Perlisque. If you don't like it;
don't use it. Don't deny others the right to have it.
If you want Python, you know where to get it.
Oh well, perhaps one day, someone will start distributing patches that
can be applied on the Perl source, and adds such an operator. I'd be
standing in line to get it.
If I look to see what's new in 5.6, I'd rather have `??' than all the
new stuff; `??' is something I would use, while the new stuff, probably
not. If I look what's introduced in 5.005 - I would gladly give that up
for `??'.
Abigail
--
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 3 Nov 1999 17:20:04 +0100
From: "Marc Lambrichs" <marcl@xs4all.nl>
Subject: Can I send SMS messages from Perl script?
Message-Id: <7vpn22$i4n$1@news1.xs4all.nl>
Is it possible to send SMS messages to my cellphone from a Perl script? Any
examples?
Cheers,
Marc
------------------------------
Date: Wed, 03 Nov 1999 15:56:28 +0000
From: Richard H <rhardicr@mail.ford.com>
Subject: core dump - perl, me or server?
Message-Id: <38205B2C.DCA22713@mail.ford.com>
Hi,
I am unfamiliar with the reasons for core dumps but the following causes
one on our Solaris box, the eval is used other places in my code and
works fine, what am I missing? is it a Perl problem or a server issue?
#!/usr/local/bin/perl -w
use diagnostics;
use strict;
&load;
sub load {
eval('use Page');
}
print "end\n";
thanks,
Richard H
------------------------------
Date: Wed, 03 Nov 1999 10:07:49 -0500
From: Ismail Mohideen <Ismail_Mohideen@amsinc.com>
Subject: Help Needed in Win32::API
Message-Id: <38204FC5.61815E05@amsinc.com>
After installing the Win32::API, I tried the test program shown in the
docs. It works like a charm. But I am trying to access a function in our
own dll, and it goes into a infinite loop.
The code looks like this
#This is the function to be called
#FUNCTION long RSSetMRTName(REF string nme, boolean so)
$setMRT = new Win32::API("D:/Program Files/Microsoft Visual
Studio/MyProjects/mrtdll/Debug/mrtdll","RSSetMRTName",[P,N],N);
$fileloc = "d:/perl/bin/AL000001.dat";
$ret = $setMRT->call($fileloc,0);
I tried debugging, looks like it goes into the loop in the AUTOLOAD
subroutine in the module.
Can any experts, or the author of the module help.
Would greatly appreciate.
Thanks.
Ismail.
------------------------------
Date: 3 Nov 1999 14:05:45 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Hiding Perl Scripts?
Message-Id: <38204139_2@newsread3.dircon.co.uk>
Abigail <abigail@delanet.com> wrote:
> LorainCounty.com Webmaster (webmaster@LorainCounty.com) wrote on MMCCLIV
> September MCMXCIII in <URL:news:381F0086.C07A440B@LorainCounty.com>:
> \\
> \\ How could I hide the source code of a Perl Script so
> \\ it can't be modified or viewed?
>
>
> $ > script
>
slighly more elegant than the 'chmod 000 script' I had in mind.
/J\
--
"I was the chief make-up artist on the Titanic" - Tina Earnshaw, Chief
Make-Up Artist, Titanic
------------------------------
Date: Wed, 03 Nov 1999 09:04:01 -0800
From: tgy@chocobo.org (Neko)
Subject: Re: How can I set reg. expresion to anchor at the end of a string?
Message-Id: <dl8gONlEM15BHgDMyms39SZ=wyGl@4ax.com>
On 2 Nov 1999 23:24:32 -0600, abigail@delanet.com (Abigail) wrote:
>Vincent Murphy (vincent.murphy@cybertrust.gte.com) wrote on MMCCLV
>September MCMXCIII in <URL:news:xjgu2n4fceg.fsf@gamora.ndhm.gtegsc.com>:
>,,
>,, Simply do:
>,,
>,, perl -e '$string="123424";$tmp=reverse $string; @stnemele=$tmp=~/(?:(\d{4}|\d+))/g; \
>,, @elements= map { $n=reverse($_); $n } @stnemele; print join(", ", @elements), "\n";'
>,,
>
>A short, but quadratic solution:
>
> split /(?=(?:....)*$)/;
My first try was also quadratic. Actually, it was just "going to do a whole
lot of work to get each match", but after seeing Abigail's code/comment and
thinking about it some, I've decided to just call it "quadratic" as well. :)
my @a = /.+?(?=(?:....)*\z)/gs;
My second try is less quadratic:
my @a = /(?!^)....|.+?(?=(?:....)*\z)/gs;
--
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: Wed, 3 Nov 1999 06:40:54 -0800
From: "Peter Steele" <psteele@opticalnetworks.com>
Subject: How do I prevent wildcard expansion on the command line?
Message-Id: <WPXT3.92$YE5.767@client>
I'm getting back into Perl after a ten year absence. I probably used to know
the answer to this but it escapes me right now. I'm writing a simple perl
app under Windows NT that can optionally be executed as
myapp /?
which is more or less standard for DOS commands to display a brief help
message about the command. When I do this though the /? is being treating as
a file reference with wildcards so when I check $ARGV[0] it isn't "/?". How
do I prevent this from happening?
------------------------------
Date: Wed, 03 Nov 1999 15:23:52 GMT
From: patelni101480@my-deja.com
Subject: Re: Is there a *wildcard that I can use to match text?
Message-Id: <7vpk22$v9r$1@nnrp1.deja.com>
In article <38204118.933D142B@sympac.com.au>,
Scotty <scotnet@sympac.com.au> wrote:
> I have a cgi perl script and i want to replace a section of HTML that
is
> put in to a varible. I only want to change it if the value of another
> array is true.......... It's a bit complicated to explain fully but
> here is what I want to do.
>
> say the vairble = the following:
>
> $middle_col_inputs = "\<td align\=\"center\"\>\<input type\=\"text\"
>
name\=\"$name\:\:CCCC\:\:$middle_colum_values[$mid_col_num]\:\:$price\"
> size\=\"3\" maxlength\=\"4\"\>\<\/td\>\r";
>
> How do I change say just everything between the <td> & </td>.
>
> Is there a wildcard that I can use ....... somthing like:
> $middle_col_inputs=~s/\<td align\=\"center\"\>*<\/td\>\r / \<td
> align\=\"center\"\><b\>X<\/td\>/g;
>
> (the value of $middle_col_inputs will vary and will not be the same
> length every time)
>
> Thank you for your time.
>
> Scott Laughton.
>
> You might want to try using the =~ symbol in perl, to test certain
patterns. I don't know if this is what your looking for, but this is
just a suggestion. The =~ is a pattern matching code in perl, and you
can set it to find whatever you need.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 3 Nov 1999 08:54:55 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Is there a *wildcard that I can use to match text?
Message-Id: <Pine.GSO.4.10.9911030854020.29670-100000@user2.teleport.com>
On Wed, 3 Nov 1999 patelni101480@my-deja.com wrote:
> The =~ is a pattern matching code in perl, and you
> can set it to find whatever you need.
Your first assertion is false, and your second is dubious. Oh, well!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 3 Nov 1999 08:56:52 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Is there a *wildcard that I can use to match text?
Message-Id: <Pine.GSO.4.10.9911030856130.29670-100000@user2.teleport.com>
On Thu, 4 Nov 1999, Scotty wrote:
> How do I change say just everything between the <td> & </td>.
It sounds as if you'll want to use HTML::Parser from CPAN. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 03 Nov 1999 14:33:54 GMT
From: Peach <schoedema@my-deja.com>
Subject: Limit of Win32::GetTickCount
Message-Id: <7vph4j$ssa$1@nnrp1.deja.com>
Hi all,
I've been written a little perl program to calculate the uptime of my
system using the function Win32::GetTickCount, which returns the
elapsed time in milliseconds since the last system boot time.
The script is working fine until an uptime of approximately 50 days.
Then the counter is reseted to zero.
Does anyone know a workaround of this problem?
My perl program:
---------------------------------------------------------------------
$uptime = int(Win32::GetTickCount()/1000); # uptime in seconds
$uptime_sec = $uptime%60;
$uptime_min = int($uptime/60)%60;
$uptime_hour = int($uptime/3600)%60;
$uptime_day = int($uptime/86400)%24;
print "The System has been up for $uptime_day days $uptime_hour hours
$uptime_min minutes $uptime_sec seconds\n";
---------------------------------------------------------------------
Thanks for any ideas
Peter
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 03 Nov 1999 10:52:11 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Limit of Win32::GetTickCount
Message-Id: <3820683B.31D40917@mail.uca.edu>
Peach wrote:
>
> Hi all,
> I've been written a little perl program to calculate the uptime of my
> system using the function Win32::GetTickCount, which returns the
> elapsed time in milliseconds since the last system boot time.
> The script is working fine until an uptime of approximately 50 days.
> Then the counter is reseted to zero.
> Does anyone know a workaround of this problem?
Well, you could go to a 64-bit Window$ system...
50 days = 4,320,000,000 msec
2^32-1 = 4,294,967,295
2^64-1 = 1.844674407...*10^19
You might also want to use Math::BigInt
Honestly, I think that there are going to be some/most/all readers here
that are amazed that you could keep a Window$ system running
continuously for 50 days. But that's another matter. ;)
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Wed, 3 Nov 1999 10:58:07 -0500
From: "bruce" <bedesign@webspan.net>
Subject: mirror command
Message-Id: <s20mgi3j24228@corp.supernews.com>
Hi All,
I've been using the activestate version of Perl on my pc and I'm using the
mirror command, its real simple code:
use LWP::Simple;
mirror( 'http://www ....
When I load the code up to the server and run it, I get the massage that it
can't find LWP/simple.pm, I've load the simple.pm file to the cgi directory;
what do I need to do to call this module from my directory(is this
possible). (Sorry I'm a newbie, is this where I would use the Autoloader?)
This is a 'pay' server and they don't want me rebuilding their libraries
which is the only way I've seen documented on how to install modules.
thanks all,
Bruce
------------------------------
Date: Wed, 3 Nov 1999 08:48:27 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Need to remove url and keep file
Message-Id: <Pine.GSO.4.10.9911030846280.29670-100000@user2.teleport.com>
On Wed, 3 Nov 1999 crackbaby1@my-deja.com wrote:
> I have a program that will let users upload a file by letting them
> browse through their hard drive and hitting upload. All I need to do is
> when the form is submitted I need to remove, ie. (C:\WINNT\.....\)
> but keep the file name, ie.(go.gif)
>
> Any ideas?
Maybe you want File::Basename. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 03 Nov 1999 15:27:49 GMT
From: mgrabens@popd.isinet.com
Subject: Perl and AIX v4.3.2
Message-Id: <7vpk9f$vki$1@nnrp1.deja.com>
We have tried building Perl versions 5.004_04 and 5.005_03 on AIX 4.3.
The builds all look successful and many perl scripts run, but some
don't. The symptoms I am running into are:
1) Perl core dumps on compile only
2) Different shell environments cause Perl to dump core
3) Running the program with she-bang to perl binary dumps core, but
running same binary on command line program runs fine (ie. "perl myprog"
works)
4) Compile only will core dump, but running it is fine.
Crazy thing about #1 is usually if '-c' is dumping core '-cw' will not.
If both dump core, then the other version of perl will compile it with
'-cw' and warn about something like 'varibable $x used only once,
possible typo.' We fix that and then both versions of perl will compile
it.
One I don't know how to say... I have a program 'myprog.pl' and
'myprog.new' they are hard links to the same i-node, but myprog.pl core
dumps when you run it and myprog.new does not.
My perl was built with IBM's C/C++ compiler on AIX v4.3.2.
Is there some patch to AIX, or Perl I need to install to make this
stable ?
Or is there a new version of Perl that is stable under AIX v4.3.2 ?
Someone else has tried to build Perl with gcc on one of our other AIX
v4.3.2 server and has similar results, so I have not tried.
Thanks,
Mike
mgrabens@popd.isinet.com
#include <std.disclaimers>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 03 Nov 1999 14:42:31 GMT
From: ajmayo@my-deja.com
Subject: Perl and commonsense part 2
Message-Id: <7vphkm$tap$1@nnrp1.deja.com>
Further to my previous post. My colleague asked me how you would
combine two hashes to create a single hash.
Well, this is simple with two arrays. Just use push..
$a[0]=1;
$a[1]=2;
@b=@a;
$b[0]=3;
$b[1]=4;
push @a,@b;
print $a[2],"\n";
So, let's use commonsense. To do the same with two hashes, you'd do
this, right?
$a{'1'}=1;
$a{'2'}=2;
%b=%a;
$b{'3'}=3;
$b{'4'}=4;
push %a,%b;
print $a{'4'},"\n";
Don't be silly. This doesn't work. Hashes are not arrays. Perl:1,
commonsense:nil.
Incidentally in Javascript arrays are indexed by either a numeric
subscript *or* a key, making them both hashes and arrays. This, on the
surface, strikes me as a somewhat more orthogonal approach.
PS: how *do* you combine two hashes, then, without explicitly iterating
over one of them?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 03 Nov 1999 10:21:04 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl and commonsense part 2
Message-Id: <x7iu3j8uu7.fsf@home.sysarch.com>
>>>>> "a" == ajmayo <ajmayo@my-deja.com> writes:
a> Further to my previous post. My colleague asked me how you would
a> combine two hashes to create a single hash.
a> So, let's use commonsense. To do the same with two hashes, you'd do
a> this, right?
a> push %a,%b;
no. arrays are not hashes. push is defined for arrays.
a> Don't be silly. This doesn't work. Hashes are not arrays. Perl:1,
a> commonsense:nil.
perl: 1, your lack of understanding arrays vs. hashes: 0
a> Incidentally in Javascript arrays are indexed by either a numeric
a> subscript *or* a key, making them both hashes and arrays. This, on the
a> surface, strikes me as a somewhat more orthogonal approach.
javascript is not worthy to compare to perl. try VB instead. :-)
a> PS: how *do* you combine two hashes, then, without explicitly iterating
a> over one of them?
@hash1{ keys %hash2 } = values %hash2 ;
fairly easy.
if you want to not overwrite existing keys in %hash1, then you have to
loop. tom c has posted (maybe in the cookbook as well) a nice hpush sub
that does that for you.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 03 Nov 1999 10:23:06 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Perl and commonsense part 2
Message-Id: <brian-0311991023070001@183.new-york-58-59rs.ny.dial-access.att.net>
In article <7vphkm$tap$1@nnrp1.deja.com>, ajmayo@my-deja.com wrote:
>Further to my previous post. My colleague asked me how you would
>combine two hashes to create a single hash.
>So, let's use commonsense. To do the same with two hashes, you'd do
>this, right?
>push %a,%b;
why would you do that? i would think that common sense would tell
you that a hash is not an array so you can't use array operators
with hashes.
>Don't be silly. This doesn't work. Hashes are not arrays. Perl:1,
>commonsense:nil.
would you think it common sense to use a hammer with a screw? use
the right tool for the right job. if you don't know how to use the
tool, read it's owners manual. the docs for push don't even hint
at being able to use it with anything but arrays.
>Incidentally in Javascript arrays are indexed by either a numeric
>subscript *or* a key, making them both hashes and arrays. This, on the
>surface, strikes me as a somewhat more orthogonal approach.
if you want to program in Javascript, program in Javascript, but if
you want to use Perl, learn Perl and quit trying to force it to be
Javascript. that should hold for any new language you learn.
>PS: how *do* you combine two hashes, then, without explicitly iterating
>over one of them?
@hash{keys %hash2} = values %hash2;
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 03 Nov 1999 16:26:34 +0100
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Perl and commonsense part 2
Message-Id: <3820542A.36CF7F34@ife.ee.ethz.ch>
ajmayo@my-deja.com wrote:
> Well, this is simple with two arrays. Just use push..
> So, let's use commonsense. To do the same with two hashes, you'd do
> this, right?
> push %a,%b;
> Don't be silly. This doesn't work. Hashes are not arrays. Perl:1,
> commonsense:nil.
Common sense tells me to read the docs. push is for arrays.
my @interm = %a; #hash->array
push @interm,%b; #combine
%a = @interm; #array->hash
> PS: how *do* you combine two hashes, then, without explicitly iterating
> over one of them?
That was discussed a short time ago.
%combined = (%a,%b); #fastest way to combine two hashes
@a{keys %b} = values %b; #IIRC fastest way to add one hash to another
The solution with push does the same, using more time and space.
If both contain the same keys if you don't want to just take the keys
from one of them, you have to iterate explicitly
- Alex
------------------------------
Date: Wed, 3 Nov 1999 07:24:40 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: Perl and commonsense part 2
Message-Id: <MPG.1289f39293c5e56398983b@nntp1.ba.best.com>
ajmayo@my-deja.com (ajmayo@my-deja.com) seems to say...
> Further to my previous post. My colleague asked me how you would
> combine two hashes to create a single hash.
%z = ( %x, %y );
That was my commonsense approach.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Wed, 3 Nov 1999 10:39:41 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Perl and commonsense part 2
Message-Id: <Pine.GSO.4.10.9911031035010.12955-100000@crusoe.crusoe.net>
[posted & mailed]
> $a[0]=1;
> $a[1]=2;
> @b=@a;
WHY do that?
> $b[0]=3;
> $b[1]=4;
> push @a,@b;
> print $a[2],"\n";
> So, let's use commonsense. To do the same with two hashes, you'd do
> this, right?
No, and you answer it yourself. Hashes aren't arrays. You don't take
tablets of medicine intravenously, just because you take some liquid
medicines that way, do you?
> $a{'1'}=1;
> $a{'2'}=2;
> %b=%a;
> $b{'3'}=3;
> $b{'4'}=4;
> push %a,%b;
> print $a{'4'},"\n";
You can't use push() on non-arrays. Simple.
> PS: how *do* you combine two hashes, then, without explicitly iterating
> over one of them?
Why don't you want to iterate?
%a = (%a,%b); # slow for big hashes
@a{keys %b} = values %b; # slow for big hashes
There are other ways to do it, but I opt for the nice fast way here:
$a{$k} = $v while my (k,$v) = each %b;
--
MIDN 4/C PINYAN, USNR, NROTCURPI
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
------------------------------
Date: 3 Nov 1999 16:33:51 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: Perl and commonsense part 2
Message-Id: <7vpo5f$l1g$1@rguxd.viasystems.com>
ajmayo@my-deja.com wrote:
:>Further to my previous post. My colleague asked me how you would
:>combine two hashes to create a single hash.
[snip]
:>PS: how *do* you combine two hashes, then, without explicitly iterating
:>over one of them?
[snip]
:>Sent via Deja.com http://www.deja.com/
:>Before you buy.
Use deja and look for a thread on this very topic from last week.
There are several ways to do it and the thread had benchmarks to
compare them. I think it is also in the faq. Well, not exactly,
but there is enough material there (`perldoc -q hash`) to deduce
some answers.
Commonsense is relative to how much sense you have. :-) In this
case it is relative to your level of ignorance -- a correctable
condition. But you should probably be a little more careful about
slamming Perl in c.l.p.misc until you have eliminated most of your
ignorance about the language and can do it with some authority and
sound logic. Otherwise you will reap the scorn you mentioned in your
previous post on this subject. Perl is not perfect and some
critcisms are valid. Your particular criticism in this thread is
not.
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
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 V9 Issue 1265
**************************************