[17863] in Perl-Users-Digest
Perl-Users Digest, Issue: 23 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 9 09:05:34 2001
Date: Tue, 9 Jan 2001 06:05:15 -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: <979049115-v10-i23@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 9 Jan 2001 Volume: 10 Number: 23
Today's topics:
Re: ASCII to integer conversion (Abigail)
Re: ASCII to integer conversion (Villy Kruse)
Re: ASCII to integer conversion <cliff@*MYLASTNAMEHERE*.nl>
Re: ASCII to integer conversion (Rafael Garcia-Suarez)
Re: ASCII to integer conversion (Martien Verbruggen)
Re: ASCII to integer conversion (Tad McClellan)
Re: Bit-Shifting and 16-bit numbers (Anno Siegel)
CGI vs Javascript dropdowns damian_taylor@my-deja.com
Re: getting bash output to a perl variable. <aaron@SPAM-O-RAMA.smalltime.com>
Re: getting bash output to a perl variable. (Martien Verbruggen)
Re: Help sending a form info in HTML format egwong@netcom.com
Re: How do I pass an object to a sub-routine (Abigail)
Re: How do I work out a percentage to just one decimal (Peter J. Acklam)
Re: If I don't want to 'goto' (Abigail)
Is $? set when using backticks to issue a system comman <brannon@lnc.usc.edu>
Re: Need help matching multiple if's.. nobull@mail.com
Re: nested foreach needed? <nickco3@yahoo.co.uk>
Re: nested foreach needed? <ducateg@info.bt.co.uk>
Perl 5.6.0 compiling <Carsten.Hammer@ops.de>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 Jan 2001 09:40:50 GMT
From: abigail@foad.org (Abigail)
Subject: Re: ASCII to integer conversion
Message-Id: <slrn95ln52.ioc.abigail@tsathoggua.rlyeh.net>
anm imroz choudhury (aichoudh@cs.uchicago.edu) wrote on MMDCLXXXVII
September MCMXCIII in <URL:news:Pine.LNX.4.21.0101081542410.9913-100000@bleys.cs.uchicago.edu>:
() Hello everyone. I have a simple question the answer to which I just can't
() find anywhere.
()
() Is there a function in perl similar to the atoi() function in C that takes
() a string containing numerals, and outputs the integer that the string
() represents? I'd appreciate any help with this, thanks in advance.
If you would know the very basics of Perl, you'd know how silly the
question is.
If you want C, use C. If you want Perl, RTFM.
Abigail
--
perl -we'$;=$";$;{Just=>another=>Perl=>Hacker=>}=$/;print%;'
------------------------------
Date: 9 Jan 2001 10:11:57 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: ASCII to integer conversion
Message-Id: <slrn95lovc.8ot.vek@pharmnl.ohout.pharmapartners.nl>
On 9 Jan 2001 09:40:50 GMT, Abigail <abigail@foad.org> wrote:
>() Is there a function in perl similar to the atoi() function in C that takes
>() a string containing numerals, and outputs the integer that the string
>() represents? I'd appreciate any help with this, thanks in advance.
>
>
>If you would know the very basics of Perl, you'd know how silly the
>question is.
>
>If you want C, use C. If you want Perl, RTFM.
>
Just to answer the original question. One of the design features of
Perl is that conversion between numbers and strings occurs implicitely
as needed. Thus an atoi is not required. This is a feature also found
in sh and awk, from where it probably has been inspired.
It is still a good idea to read the documentation that comes with perl,
all of it, it is quite a lot, but read it so you know where things are
described. A good book on Perl might be easier to digest in the beginning,
though.
Villy
------------------------------
Date: Tue, 09 Jan 2001 11:28:14 +0100
From: Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl>
Subject: Re: ASCII to integer conversion
Message-Id: <93epse$54e$1@news.news-service.com>
Abigail wrote:
>
> If you would know the very basics of Perl, you'd know how silly the
> question is.
An why is this silly? I've just started programming in Perl and I have
encountered the exact same "problem" numerous times.
For instance, suppose we have a string that contains an important value
we need for some other stuff. The only thing we know and can be certain
of, is that this value can be found directly *after* a fixed delimiter
(in this case a ","). Now everything directly following this number can
be literally anything, except numbers:
$a_string = "Random string with a value from somewhere,1234m/s";
$a_number = substr( $a_string, index( $a_string, "," ) );
Now we need to pass this number to another program:
`a_program $a_string`;
See the problem? Now this of course can be easily fixed, the easiest
(afaik) being by just adding the line (which also would be the answer to
his question):
$a_number += 0;
But if you have a background in C (or almost any other programming
language), this is pretty weird stuff.
But like I said, I just started programming in Perl so maybe I'm doing
some prety dumb stuff myself, in which case I would gladly hear that
from people... :-D
------------------------------
Date: Tue, 09 Jan 2001 11:11:25 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: ASCII to integer conversion
Message-Id: <slrn95lsf7.lab.rgarciasuarez@rafael.kazibao.net>
Clifford Pennock wrote in comp.lang.perl.misc:
> Abigail wrote:
> >
> > If you would know the very basics of Perl, you'd know how silly the
> > question is.
>
> An why is this silly? I've just started programming in Perl and I have
> encountered the exact same "problem" numerous times.
>
> For instance, suppose we have a string that contains an important value
> we need for some other stuff. The only thing we know and can be certain
> of, is that this value can be found directly *after* a fixed delimiter
> (in this case a ","). Now everything directly following this number can
> be literally anything, except numbers:
>
> $a_string = "Random string with a value from somewhere,1234m/s";
> $a_number = substr( $a_string, index( $a_string, "," ) );
>
> Now we need to pass this number to another program:
>
> `a_program $a_string`;
You should probably worry for security here (as each time a shell is
spawned).
> See the problem? Now this of course can be easily fixed, the easiest
> (afaik) being by just adding the line (which also would be the answer to
> his question):
>
> $a_number += 0;
The easiest fix is to do nothing, because there is no difference between
strings and numbers in Perl, and it is _very_ important to understand
this if you don't want to introduce strange bugs in your programs. The
name for variables that holds simple values (strings and numbers) is
'scalars', and they can be used as numbers or as strings -- this depends
on the context. Moreover, the perlfaq4 manpage anwers the FAQ "How do I
determine whether a scalar is a number/whole/integer/float?". Read the
manual, and learn the basics of Perl, as Abigail told you to do.
> But if you have a background in C (or almost any other programming
> language), this is pretty weird stuff.
awk and sh are two examples of very commonly used scripting languages
that behave as Perl for this matter.
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Tue, 9 Jan 2001 22:21:15 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: ASCII to integer conversion
Message-Id: <slrn95lt1a.f4u.mgjv@martien.heliotrope.home>
On Tue, 09 Jan 2001 11:28:14 +0100,
Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl> wrote:
> Abigail wrote:
>>
>> If you would know the very basics of Perl, you'd know how silly the
>> question is.
>
> An why is this silly? I've just started programming in Perl and I have
> encountered the exact same "problem" numerous times.
>
> For instance, suppose we have a string that contains an important value
> we need for some other stuff. The only thing we know and can be certain
> of, is that this value can be found directly *after* a fixed delimiter
> (in this case a ","). Now everything directly following this number can
> be literally anything, except numbers:
>
> $a_string = "Random string with a value from somewhere,1234m/s";
> $a_number = substr( $a_string, index( $a_string, "," ) );
>
> Now we need to pass this number to another program:
>
> `a_program $a_string`;
>
> See the problem? Now this of course can be easily fixed, the easiest
> (afaik) being by just adding the line (which also would be the answer to
> his question):
>
> $a_number += 0;
Unfortunately, perl isn't quite _that_ smart. You'll have to extract the
number yourself. Watch:
$ perl -wle '$_ = "random stuff,1234m/s"; $_ += 0; print'
Argument "random stuff,1234m/s" isn't numeric in addition (+) at -e line 1.
0
Perl's automagical conversion from strings to numbers works very much
like the strto*() functions in C, or the mentioned atoi() function. Your
string is allowed to start with whitespace, but the first character has
to be a numerical character (or + or -). In other words, it has to be
part of a valid number. Everything after that first valid number is
ignored. If your string starts with anything that isn't a number, it'll
become 0. Note that Perl will always warn if your string isn't purely
numerical.
> But if you have a background in C (or almost any other programming
> language), this is pretty weird stuff.
Partly, but not entirely. The conversion rules are pretty easy to
understand in terms of the strto*() functions, albeit that Perl does the
'type' detection automatically. The fact that there is no type may be
odd to a C programmer, but it is so _fundamental_ to the Perl language,
that everyone dabbling in it _should_ know this. A cursory reading of
the first bit of perldata would make it clear that there are no types.
I, myself, came to Perl with a quite extensive C background (and some
other typed languages like fortran and pascal, and some others I won't
mention), but I never had troubles dealing with the fact that there are
no types in Perl. Maybe the Unix background I had helped. sh, csh and
awk don't have types.
> But like I said, I just started programming in Perl so maybe I'm doing
> some prety dumb stuff myself, in which case I would gladly hear that
> from people... :-D
Everyone does 'dumb' stuff when they start out with any language. Only
experience can make that go away, at least partly. But the OP should
also realise that to become a programmer in any language, you will need
to _read_, read, and read more. Getting to know the language starts with
reading the documentation. In the case of Perl that is the documentation
(starting with the perl manual page) and maybe a good book. Perl's
typelessness should have been obvious to anyone who'd read the few
manuals that are mentioned in the beginning of the list in the perl
documentation, just after the 'meta-manuals':
perldata Perl data structures
perlsyn Perl syntax
perlop Perl operators and precedence
perlre Perl regular expressions
perlrun Perl execution and options
perlfunc Perl builtin functions
Those pieces of documentation are a must. No one can even begin typing
their first Perl code without having read them at least once. Anyone
with a C background will find much of perlop and perlsyn easy to deal
with, and perldata enlightening.
Oh, and because the OP specifically mentioned 'integer', and most of
Perl's auto-conversion stuff and arithmentic works with doubles, he'd
also need the int() function, described in the last manual page from
that list above.
Martien
--
Martien Verbruggen |
Interactive Media Division | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use
NSW, Australia | being a damn fool about it.
------------------------------
Date: Tue, 9 Jan 2001 06:33:17 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: ASCII to integer conversion
Message-Id: <slrn95ltnt.26n.tadmc@tadmc26.august.net>
anm imroz choudhury <aichoudh@cs.uchicago.edu> wrote:
>
>Is there a function in perl similar to the atoi() function in C that takes
>a string containing numerals, and outputs the integer that the string
>represents?
Why do you think you need to do this?
Such things are rarely needed in Perl.
What problem is it that you are trying to solve where you think
that this can help?
>Please respond to aichoudh@uchicago.edu, thanks.
Nope. Ask it here, get the answer here (maybe).
[ that is a very selfish request that can get you killfiled. The
newsgroup does not exist to serve you. It exists to serve the
Perl community. Emailed answers serve only you, nobody else
gets to see the answer. Posted answers serve the community
because they are available to the community.
]
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 9 Jan 2001 10:42:34 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Bit-Shifting and 16-bit numbers
Message-Id: <93epuq$o8g$1@mamenchi.zrz.TU-Berlin.DE>
Steve Reed <steve@reedelectronics.com> wrote in comp.lang.perl.misc:
>Following is a chunk of code that I'm working with (it interfaces with a
>software security device). When the computations are complete, the value of
>$Arg1 is supposed to be zero. For this algorithm to work correctly, all the
>numbers must remain 16-bit values. The problem seems to be that the bit
>shift that returns the value "$RotatedReturnValue1" keeps returning a 32-bit
>integer. Anyone know how I can keep all the numbers at the 16-bit level so
>the bit-wise operations make sense and the end result is correct?
Just mask off the unwanted bits with an and-operation, the way you
do it now with $returnvalue1 below. Often the masking operation
can be postponed until the very end of the calculation. The exception
is a right shift, where it may be necessary to get rid of the more
significant bits before shifting.
If you want real 16-bit quantities, perl's vec operation gives you
those. If $v is a string, vec( $v, 0, 16) is a 16-bit integer you
can assign to and read from. But it's not necessary and probably
inefficient and confusing to use vec() for your purpose.
Anno
[code for reference]
>Thanks.
>
>$ValidateCode1 = "422B";
>$ValidateCode2 = "FFF2";
>$ValidateCode3 = "EF90";
>$ReadCode3 = "BCF8";
>$KeyLockCheck = new Win32::API("kl2dll32", "_KFUNC\@16", [N,N,N,N], "N");
>$ReturnValue = $KeyLockCheck->Call(1, $ValidateCode1, $ValidateCode2,
>$ValidateCode3);
>$ReturnValue1 = $ReturnValue & 0xFFFF;
>$ReturnValue2 = $ReturnValue >> 16;
>$TempCode3 = $ReturnValue2 ^ $ReadCode3;
>$RotationValue = $ReturnValue2 & 7;
>$RotatedReturnValue1 = $ReturnValue1 << $RotationValue;
>$Arg1 = $TempCode3 ^ $RotatedReturnValue1;
------------------------------
Date: Tue, 09 Jan 2001 13:24:48 GMT
From: damian_taylor@my-deja.com
Subject: CGI vs Javascript dropdowns
Message-Id: <93f3es$ju1$1@nnrp1.deja.com>
I have used javascript to create a series of dynamic drop down lists
for a web page.
There is quite a lot of javascript, so I was thinking of moving it into
a separate script file, and loading it with -
<SCRIPT language=JavaScript src="dropdown.js"></SCRIPT>
Trouble is, I have recently found some perl examples that also do
dynamic drop downs, and now I'm not sure which is the best method.
Does the CGI method load all the logic into memory at the initial load?
If it doesn't and the connection to the server is slow, would it be
possible to have a long delay when the user changes a drop down while
the server is working out, and sending back what the dependant drop
downs should be?
If there is no chance of a delay, it would seem CGI is the best route
to take.
Anybody got any experience of this?
Thanks in advance.
Damian.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 9 Jan 2001 07:05:48 -0500
From: "Aaron!@#" <aaron@SPAM-O-RAMA.smalltime.com>
Subject: Re: getting bash output to a perl variable.
Message-Id: <93euqm$ava$1@nntp9.atl.mindspring.net>
Looks like I'm confusing perl and c++ again. Thanks for your help!
"Chris Fedde" <cfedde@fedde.littleton.co.us> wrote in message
news:Mry66.791$B9.192337920@news.frii.net...
> In article <93e5o5$ovi$1@slb6.atl.mindspring.net>,
> Aaron!@# <aaron@SPAM-O-RAMA.smalltime.com> wrote:
> >Hey there. I'm having trouble getting a file from a linksys router on my
> >LAN (so I can get a . Here's what I have so far:
> >
> >
> >#########
> ># Stuff #
> >#########
> >
> >$StatusPage ==
> >`wget --http-user=$RouterUserName --http-passwd=$RouterPassword
> >\"$RouterURL\" -O -`;
> >print "StatusPage is $StatusPage";
> >
>
> It looks to me like you have == where you want to have =.
>
> chris
> --
> This space intentionally left blank
------------------------------
Date: Tue, 9 Jan 2001 23:32:50 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: getting bash output to a perl variable.
Message-Id: <slrn95m17i.f4u.mgjv@martien.heliotrope.home>
On Tue, 9 Jan 2001 07:05:48 -0500,
Aaron!@# <aaron@SPAM-O-RAMA.smalltime.com> wrote:
[re-arranged post to follow the more natural ordering]
> "Chris Fedde" <cfedde@fedde.littleton.co.us> wrote in message
> news:Mry66.791$B9.192337920@news.frii.net...
>> In article <93e5o5$ovi$1@slb6.atl.mindspring.net>,
>> Aaron!@# <aaron@SPAM-O-RAMA.smalltime.com> wrote:
>> >
>> >$StatusPage ==
>> >`wget --http-user=$RouterUserName --http-passwd=$RouterPassword
>> >\"$RouterURL\" -O -`;
>>
>> It looks to me like you have == where you want to have =.
>
> Looks like I'm confusing perl and c++ again. Thanks for your help!
But, in C++ you would also have used a =, and not a == there...
Maybe you just made a typo :)
Martien
--
Martien Verbruggen |
Interactive Media Division | I took an IQ test and the results
Commercial Dynamics Pty. Ltd. | were negative.
NSW, Australia |
------------------------------
Date: Tue, 09 Jan 2001 08:37:14 GMT
From: egwong@netcom.com
Subject: Re: Help sending a form info in HTML format
Message-Id: <_4A66.364$J%.42036@news.flash.net>
In comp.lang.perl.misc BAQUANB@bellatlantic.net wrote:
> I have a form on my webpage and would like to send the info in HTML
> format not Plain Text format. I use a cgi script call Web2Mail is there
> something in the code I can change to do this. Here's the code I use.
> #!/usr/bin/perl
> ### web2mail -- An anonymous CGI mailer.
> ### See http://www.pobox.com/~cgires/web2mail/
> ### for usage and description.
> ### Copyright 1995-97, Sanford Morton <smorton@pobox.com>
> ### Thanks to Michael Grobe <grobe@ukans.edu> for a multiple
> values fix.
[ cut ]
Ideally what you would do is to email the author of your script
(smorton@pobox.com) and ask him how to change the message from plain text
to html. Since this has more to do with CGI than perl, if you must post
a usenet message, I'd suggest news://comp.infosystems.www.authoring.cgi
Anyhow, to answer your question, the variable $message holds the text
message that you want to change. All you need to do is go through these
lines and change the text that's assigned to include html markup.
> ### prepare first line of mail message
> $message = $in{'.mail_intro'} ? "$in{'.mail_intro'}\n\n"
> : "Form data submitted to $ENV{'HTTP_REFERER'}:\n\n";
For example, here you could use (note that '.' concatenates strings)
$message = "<h1>". ($in{'.mail_intro'} ? "$in{'.mail_intro'}\n\n"
: "Form data submitted to $ENV{'HTTP_REFERER'}:\n\n") . "</h1>";
> ### write the form data to the mail message
> foreach (sort keys %in) {
> next if /^\./; # skip hidden form data in mail message
> $item = "$_: $in{$_}";
> $item =~ s/^..// if $in{'.remove_indexing'};
> # if multiple values, indent them on new lines
> $item =~ s/\0/"\n\t".(" "x(2+length($_)))/ge;
> $message .= "\t$item\n";
> }
> ## do you want the environment variables?
> if ( $in{'.environment'} ) {
> $message .= "\nThe environment variables are:\n\n";
> foreach (keys %ENV) {
> $message .= "\t$_: $ENV{$_}\n";
> }
> } else {
> ## let's at least report a few
> $message .= "\nReferring page: $ENV{HTTP_REFERER}";
> $message .= "\nUser address: $ENV{REMOTE_ADDR}";
> $message .= "\nUser host: $ENV{REMOTE_HOST}";
> }
> ## prepare subject line in mail message
> $subject_line = $in{'.mail_subject'} ? "$in{'.mail_subject'}"
> : "Free Quote $ENV{'HTTP_REFERER'}";
> ## remove everything after the first comma in .email_target to
> ## prevent multiple recipients, eg, spam broadcasts
> $in{'.email_target'} =~ s/,.*//;
> ## mail it (or web it if in test mode)
> &send_mail ($mail_program, $in{'.email_target'}, $subject_line,
> $message);
[ cut ]
Don't edit any of the $message variables after here.
Good luck.
------------------------------
Date: 9 Jan 2001 09:24:56 GMT
From: abigail@foad.org (Abigail)
Subject: Re: How do I pass an object to a sub-routine
Message-Id: <slrn95lm78.ioc.abigail@tsathoggua.rlyeh.net>
Rocky Raccoon (rrocky@bigfoot.com) wrote on MMDCLXXXVIII September
MCMXCIII in <URL:news:3A5AA405.AFC7E20E@bigfoot.com>:
%%
%% use HTML::TokeParser;
%% $p = HTML::TokeParser->new("./t.html") ;
%%
%% I want to pass $p as parameter to my own sub-routine
%%
%% $a = get_next_tag($p);
%%
%% sub get_next_tag
%% {
%% $src = @_;
%% $x = $src->get_token; ### Line X
%%
%% if($x->[0] eq "S" || $x->[0] eq "E")
%% {
%% return $x ;
%% }
%% }
%%
%% This gives an error
%% Can't call method "get_token" without a package or object reference at
%% t.pl at line X.
%%
%% What am I doing wrong ?
$src = @_; # $src now contains the *number* of elements of @_.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
------------------------------
Date: 09 Jan 2001 11:46:33 +0100
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: How do I work out a percentage to just one decimal place?
Message-Id: <wkzoh1xu92.fsf@math.uio.no>
cfedde@fedde.littleton.co.us (Chris Fedde) writes:
> The classic integer rounding function is
>
> $rounded = int($value + 0.5)
`non-negative integer', mind you. For any integer, use
int $x + ( $x > 0 ? 0.5 : -0.5 );
which is faster than using sprintf().
Peter
--
$\="\n";$_='The quick brown fox jumps over the lazy dog';print +(split
//)[20,5,24,31,3,36,14,12,31,1,2,11,9,23,33,29,35,15,32,36,7,8,28,29];
------------------------------
Date: 9 Jan 2001 09:37:28 GMT
From: abigail@foad.org (Abigail)
Subject: Re: If I don't want to 'goto'
Message-Id: <slrn95lmuo.ioc.abigail@tsathoggua.rlyeh.net>
Uri Guttman (uri@sysarch.com) wrote on MMDCLXXXVII September MCMXCIII in
<URL:news:x73det7lac.fsf@home.sysarch.com>:
|| >>>>> "CB" == Craig Berry <cberry@cinenet.net> writes:
||
|| CB> my $failed = 0;
||
|| CB> for my $file (<*>) {
|| CB> if ($fail_condition1) { warn "message 1"; $failed = 1; last }
|| CB> if ($fail_condition2) { warn "message 2"; $failed = 1; last }
|| CB> if ($fail_condition3) { warn "message 3"; $failed = 1; last }
|| CB> }
||
|| CB> if (failed) {
|| CB> rename $file => "fail/$file";
|| CB> }
||
|| you can even factor out a little more:
||
|| my $failed = '';
||
|| for my $file (<*>) {
|| if ($fail_condition1) { $failed = "message 1" ; last }
|| $fail_condition2 and $failed = "message 2" and last ;
|| $failed = "message 3" and last if $fail_condition3 ;
|| }
||
|| if ( $failed ) {
|| warn $failed ;
|| rename $file => "fail/$file";
|| }
And you can play the game without extra variables or gotos:
for my $file (<*>) {
if ($fail_condition1) {warn "message 1"}
elsif ($fail_condition2) {warn "message 2"}
elsif ($fail_condition3) {warn "message 3"}
else {next}
rename $file => "fail/$file";
last;
}
Abigail
--
use lib sub {($\) = split /\./ => pop; print $"};
eval "use Just" || eval "use another" || eval "use Perl" || eval "use Hacker";
------------------------------
Date: Tue, 09 Jan 2001 13:54:06 GMT
From: Terrence Brannon <brannon@lnc.usc.edu>
Subject: Is $? set when using backticks to issue a system command
Message-Id: <lblmskg7b5.fsf@lnc.usc.edu>
PerlFAQ Server <faq@denver.pm.org> writes:
> $exit_status = system("mail-users");
> $output_string = `ls`;
Can I still get return status of the process with $?
------------------------------
Date: 09 Jan 2001 09:03:36 +0000
From: nobull@mail.com
Subject: Re: Need help matching multiple if's..
Message-Id: <u9zoh1ksgn.fsf@wcl-l.bham.ac.uk>
Wolfgang Hielscher <W.Hielscher@mssys.com> writes:
> Roger Hinson wrote:
> > This works properly, but if I
> >say the 4th and 8th with a line showing
> >
> > if ( ($y != 3) || ($y != 7) ) {
> >
> > then it doesn't ever drop down to the else.
>
> And I'm glad it does. To enter the else-block you'd need a number that
> equals both 3 and 7. I would be scared if such number exists (at least a
> number that can be stored in a Perl-scalar).
There's a suggestion that Perl6 should support quantum superposition
types (in anticipation of quantum computers). This way you prossibly
could have a number that really was both 3 and 7.
> In other words: Your if-condition holds for all $y.
Unless, of course, $y is a reference to an object of a type that
overloads really weird semantics onto !=
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 09 Jan 2001 10:57:29 +0000
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: nested foreach needed?
Message-Id: <3A5AEE99.E75FC353@yahoo.co.uk>
"Géry" wrote:
> Hi,
>
> I have a hash in a hash, I want to take the sub hashes (the hashes in the
> main hash...) and put them into a hash... I think a simple example will make
> it clearer:
>
> if you have a hash in a hash like:
>
> my %family =
> (simpsons => ( bart => son, homer=> father)
> disney => (mickey => bachelor, donald => uncle));
That gets flattened out to a single list and is initialised a as a single hash.
I think you need some curly braces:
my %family = (simpsons => { bart => son, homer=> father}, disney => {mickey =>
bachelor, donald => uncle});
> and I want to end up with a hash like:
> %merged = (bart => son, homer => father, mickey => bachelor, donald =>
> uncle);
my %merged = (%{$family{simpsons}}, %{$family{disney}});
--
Nick
------------------------------
Date: Tue, 9 Jan 2001 11:18:30 -0000
From: "Géry" <ducateg@info.bt.co.uk>
Subject: Re: nested foreach needed?
Message-Id: <93es6k$bbs$1@pheidippides.axion.bt.co.uk>
Magic, fantastic...
Thanks
--
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Géry Ducatel
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
"Nick Condon" <nickco3@yahoo.co.uk> wrote in message
news:3A5AEE99.E75FC353@yahoo.co.uk...
> "Géry" wrote:
>
> > Hi,
> >
> > I have a hash in a hash, I want to take the sub hashes (the hashes in
the
> > main hash...) and put them into a hash... I think a simple example will
make
> > it clearer:
> >
> > if you have a hash in a hash like:
> >
> > my %family =
> > (simpsons => ( bart => son, homer=> father)
> > disney => (mickey => bachelor, donald => uncle));
>
> That gets flattened out to a single list and is initialised a as a single
hash.
> I think you need some curly braces:
> my %family = (simpsons => { bart => son, homer=> father}, disney =>
{mickey =>
> bachelor, donald => uncle});
>
> > and I want to end up with a hash like:
> > %merged = (bart => son, homer => father, mickey => bachelor, donald =>
> > uncle);
>
> my %merged = (%{$family{simpsons}}, %{$family{disney}});
>
> --
> Nick
>
------------------------------
Date: Tue, 09 Jan 2001 13:56:52 +0100
From: Carsten Hammer <Carsten.Hammer@ops.de>
Subject: Perl 5.6.0 compiling
Message-Id: <3A5B0A94.5675474F@ops.de>
Hi,
did anybody compile perl on SCO Openserver 5.0.5 with Skunkware
gcc2.95.2 (p1)?
The perl selftest does give a lot of errors on my machine:
...
io/open..............ok
io/openpid...........Can't load '../lib/auto/IO/IO.so' for module IO:
dynamic linker: ./perl: relocation error: symbol not found: main at
../lib/XSLoader.pm line 73.
at ../lib/IO.pm line 9
Compilation failed in require at ../lib/IO/Handle.pm line 241.
BEGIN failed--compilation aborted at ../lib/IO/Handle.pm line 241.
Compilation failed in require at ../lib/IO/Seekable.pm line 51.
BEGIN failed--compilation aborted at ../lib/IO/Seekable.pm line 51.
Compilation failed in require at ../lib/IO/File.pm line 112.
BEGIN failed--compilation aborted at ../lib/IO/File.pm line 112.
Compilation failed in require at ../lib/FileHandle.pm line 9.
Compilation failed in require at io/openpid.t line 20.
BEGIN failed--compilation aborted at io/openpid.t line 20.
FAILED at test 0
io/pipe..............ok
io/print.............ok
...
op/context...........ok
op/defins............Can't load '../lib/auto/File/Glob/Glob.so' for
module File::Glob: dynamic linker: ./perl: relocation error: symbol not
found: main at ../lib/XSLoader.pm line 73.
at ../lib/File/Glob.pm line 94
Compilation failed in require at op/defins.t line 95.
BEGIN failed--compilation aborted at op/defins.t line 95.
FAILED at test 1
op/delete............ok
...
op/read..............ok
op/readdir...........Can't load '../lib/auto/File/Glob/Glob.so' for
module File::Glob: dynamic linker: ./perl: relocation error: symbol not
found: main at ../lib/XSLoader.pm line 73.
at ../lib/File/Glob.pm line 94
Compilation failed in require at op/readdir.t line 26.
BEGIN failed--compilation aborted at op/readdir.t line 26.
FAILED at test 0
op/recurse...........ok
op/ref...............ok
...
op/sysio.............ok
op/taint.............Can't load '../lib/auto/IPC/SysV/SysV.so' for
module IPC::SysV: dynamic linker: ./perl: relocation error: symbol not
found: main at ../lib/DynaLoader.pm line 200.
at ../lib/IPC/SysV.pm line 54
Compilation failed in require at op/taint.t line 28.
BEGIN failed--compilation aborted at op/taint.t line 31.
FAILED at test 0
op/tie...............ok
...
...
lib/timelocal........ok
lib/trig.............ok
Failed 45 test scripts out of 189, 76.19% okay.
### Since not all tests were successful, you may want to run some
### of them individually and examine any diagnostic messages they
### produce. See the INSTALL document's section on "make test".
### If you are testing the compiler, then ignore this message
### and run
### ./perl harness
### in the directory ./t.
u=0.38 s=0.19 cu=16.79 cs=5.33 scripts=189 tests=10102
make: *** [test] Error 1
Does anybody know whats going on there?
In fact I want to compile gimp (that uses a lot of perl). This is not
completely successfully with the Skunkware perl:
Can't load
'/usr/local/lib/perl5/site_perl/5.005/i386-sco/auto/Gimp/UI/UI.so' for
module Gimp::UI: dynamic linker: /usr/local/bin/perl: relocation error:
symbol not found: gtk_marshal_NONE__NONE at
/usr/local/lib/perl5/5.00503/i386-sco/DynaLoader.pm line 169.
at /usr/local/lib/gimp/1.2/plug-ins/PDB line 13
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.005/i386-sco/Gimp/UI.pm line 17.
BEGIN failed--compilation aborted at
/usr/local/lib/gimp/1.2/plug-ins/PDB line 13.
LibGimp-WARNING **: gimp: wire_read: unexpected EOF
Can't load
'/usr/local/lib/perl5/site_perl/5.005/i386-sco/auto/Gimp/UI/UI.so' for
module Gimp::UI: dynamic linker: /usr/local/bin/perl: relocation error:
symbol not found: gtk_marshal_NONE__NONE at
/usr/local/lib/perl5/5.00503/i386-sco/DynaLoader.pm line 169.
at /usr/local/lib/gimp/1.2/plug-ins/avi line 13
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.005/i386-sco/Gimp/UI.pm line 17.
BEGIN failed--compilation aborted at
/usr/local/lib/gimp/1.2/plug-ins/avi line 13.
LibGimp-WARNING **: gimp: wire_read: unexpected EOF
Can't load
'/usr/local/lib/perl5/site_perl/5.005/i386-sco/auto/Gimp/UI/UI.so' for
module Gimp::UI: dynamic linker: /usr/local/bin/perl: relocation error:
symbol not found: gtk_marshal_NONE__NONE at
/usr/local/lib/perl5/5.00503/i386-sco/DynaLoader.pm line 169.
at /usr/local/lib/gimp/1.2/plug-ins/colorhtml line 12
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.005/i386-sco/Gimp/UI.pm line 17.
BEGIN failed--compilation aborted at
/usr/local/lib/gimp/1.2/plug-ins/colorhtml line 12.
LibGimp-WARNING **: gimp: wire_read: unexpected EOF
Can't load
'/usr/local/lib/perl5/site_perl/5.005/i386-sco/auto/Gimp/UI/UI.so' for
module Gimp::UI: dynamic linker: /usr/local/bin/perl: relocation error:
symbol not found: gtk_marshal_NONE__NONE at
/usr/local/lib/perl5/5.00503/i386-sco/DynaLoader.pm line 169.
at /usr/local/lib/gimp/1.2/plug-ins/dataurl line 13
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.005/i386-sco/Gimp/UI.pm line 17.
BEGIN failed--compilation aborted at
/usr/local/lib/gimp/1.2/plug-ins/dataurl line 13.
LibGimp-WARNING **: gimp: wire_read: unexpected EOF
Can't load
'/usr/local/lib/perl5/site_perl/5.005/i386-sco/auto/Gimp/UI/UI.so' for
module Gimp::UI: dynamic linker: /usr/local/bin/perl: relocation error:
symbol not found: gtk_marshal_NONE__NONE at
/usr/local/lib/perl5/5.00503/i386-sco/DynaLoader.pm line 169.
at /usr/local/lib/gimp/1.2/plug-ins/miff line 13
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.005/i386-sco/Gimp/UI.pm line 17.
BEGIN failed--compilation aborted at
/usr/local/lib/gimp/1.2/plug-ins/miff line 13.
LibGimp-WARNING **: gimp: wire_read: unexpected EOF
What does all this mean? Is there a problem with elf on SCO?
Thanks in advance,
ciao
Carsten
------------------------------
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 23
*************************************