[16552] in Perl-Users-Digest
Perl-Users Digest, Issue: 3964 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 9 14:05:34 2000
Date: Wed, 9 Aug 2000 11:05:20 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <965844320-v9-i3964@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 9 Aug 2000 Volume: 9 Number: 3964
Today's topics:
Re: "use strict" error message (Greg Bacon)
Re: "use strict" error message <pavel@gingerall.cz>
Re: "use strict" error message <ren.maddox@tivoli.com>
Re: "use strict" error message <amonotod@netscape.net>
Re: 64 bit threaded perl on HP-UX 11 anevynni@my-deja.com
Re: 64 bit threaded perl on HP-UX 11 (Richard J. Rauenzahn)
Re: CGI/Pearl Interfacing w/ DOS Program Question vagabond_nomad@my-deja.com
Re: Converting from US dates/numbers to European dates/ <newsposter@cthulhu.demon.nl>
Re: Converting from US dates/numbers to European dates/ <russ_jones@rac.ray.com>
Re: Converting from US dates/numbers to European dates/ <godzilla@stomp.stomp.tokyo>
Re: Converting from US dates/numbers to European dates/ (Logan Shaw)
Re: Converting from US dates/numbers to European dates/ <godzilla@stomp.stomp.tokyo>
Re: Converting from US dates/numbers to European dates/ <flavell@mail.cern.ch>
Re: Converting from US dates/numbers to European dates/ <lr@hpl.hp.com>
Re: Converting from US dates/numbers to European dates/ <lr@hpl.hp.com>
Re: Converting from US dates/numbers to European dates/ <newsposter@cthulhu.demon.nl>
Re: correction: sorting problem! output should be (a A <abe@ztreet.demon.nl>
Re: dropping space from begginning & end of a string <groovyt@erols.com>
Re: Expert advise needed <bart.lateur@skynet.be>
failures in bigfltpm test during make test <nick31@my-deja.com>
feeding output of grep to a variable. <bunnyman77@hotmail.com>
Re: feeding output of grep to a variable. (Rafael Garcia-Suarez)
Re: feeding output of grep to a variable. <ren.maddox@tivoli.com>
Re: files transferred by socket? nobull@mail.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 09 Aug 2000 15:41:31 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: "use strict" error message
Message-Id: <sp2utbld63a91@corp.supernews.com>
In article <39916F8C.4F6FDFAA@yahoo.es>,
Javier Hijas <jhijas@yahoo.es> wrote:
: Could someone tell me what does it means?
:
: Global symbol "$YP_DIR" requires explicit package name at ./usradm line
: 16
Did you look up that error message in the perldiag manpage?
Greg
--
The power of accurate observation is commonly called cynicism by those who
have not got it.
-- George Bernard Shaw
------------------------------
Date: Wed, 09 Aug 2000 17:33:24 +0200
From: Pavel Hlavnicka <pavel@gingerall.cz>
Subject: Re: "use strict" error message
Message-Id: <399179C4.1010706@gingerall.cz>
it means, that you should read perldoc strict :-)
If you are using 'strict' pragma, then you have to declare all variables.
a) lexically, using 'my', f.e.: my $YP_DIR = ...
b) package global variables may be defined as follows:
use vars ($YP_DIR)
Javier Hijas wrote:
> Could someone tell me what does it means?
>
> Global symbol "$YP_DIR" requires explicit package name at ./usradm line
> 16
>
------------------------------
Date: 09 Aug 2000 10:26:50 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: "use strict" error message
Message-Id: <m3ittabglh.fsf@dhcp11-177.support.tivoli.com>
Javier Hijas <jhijas@yahoo.es> writes:
> Could someone tell me what does it means?
>
> Global symbol "$YP_DIR" requires explicit package name at ./usradm line
> 16
% splain -p <<EOF
Global symbol "$YP_DIR" requires explicit package name at ./usradm line 16
EOF
Global symbol "" requires explicit package name at ./usradm line 16 (#1)
(F) You've said "use strict vars", which indicates that all variables
must either be lexically scoped (using "my"), declared beforehand using
"our", or explicitly qualified to say which package the global variable
is in (using "::").
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 09 Aug 2000 17:15:08 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: "use strict" error message
Message-Id: <8ms3in$ved$1@nnrp1.deja.com>
In article <39916F8C.4F6FDFAA@yahoo.es>,
Javier Hijas <jhijas@yahoo.es> wrote:
> Could someone tell me what does it means?
>
> Global symbol "$YP_DIR" requires explicit package name at ./usradm
line
> 16
>
You've got two choices...
1> use strict;
1> no strict 'vars';
1> $var =1;
2> use strict;
2> my $var = 1;
2> my @vars = ( 1, 2, 3);
2> my (@vars2, %vars3, $var4);
HTH,
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 09 Aug 2000 15:21:20 GMT
From: anevynni@my-deja.com
Subject: Re: 64 bit threaded perl on HP-UX 11
Message-Id: <8mrst8$pso$1@nnrp1.deja.com>
In article <965769032.106883@hpvablab.cup.hp.com>,
nospam@hairball.cup.hp.com (Richard J. Rauenzahn) wrote:
>
>
> anevynni@my-deja.com writes:
> >Hello,
> >
> >I'm trying to build DBD Oracle (for 8.0.6 64 bit) on HP-UX 11 and
after
> >struggling for a few days and reading everything I was able to find
on
> >Usenet, I have to ask for assistance really hoping someone will help
me out.
>
> I think you're going with an assumption here that the client libraries
> for 64bit Oracle must be 64bit, too. Not true. I don't know if
Oracle
> is shipping 64bit client libraries yet, but they are certainly still
> shipping 32bit client libraries.
DBD:Oracle compilation breaks on:
ld: /orasw/base8/805/lib/libclntsh.sl: Mismatched ABI. 64-bit PA shared
library found in 32-bit link.
And indeed:
root@hohp11: [/orasw/base8/805/lib] file libclntsh.sl
libclntsh.sl: ELF-64 shared object file - PA-RISC 2.0 (LP64)
As well as all other libraries there.
Is it possible to find 32-bit libraries?
> >My understanding is that I'll need to compile 64 bit threaded perl to
> >archieve this.
>
> Why do you think this?
This happens not only when linking against libclntsh, but with whatever
option I tried (everything in README, README.help and in
http://www.stonedoor.com/HPUX.html)
>
> >I tried two version: 5.6 and 5.005.03 with the same results.
> >These are the steps: 1) sh Configure: changes to default settings:
Build a
> >threading Perl? [n] y
>
> I think 32bit Perl is what you want.
>
> Rich
Thank you for your time, Rich.
Andrew Nevynniy
Russel Metals Inc.
> --
> Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard
Company
> Technical Consultant | I speak for me, | 19055 Pruneridge
Ave.
> Development Alliances Lab| *not* HP | MS
46TU2
> ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA
95014
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 9 Aug 2000 17:42:01 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: 64 bit threaded perl on HP-UX 11
Message-Id: <965842918.929112@hpvablab.cup.hp.com>
anevynni@my-deja.com writes:
>
>DBD:Oracle compilation breaks on:
>ld: /orasw/base8/805/lib/libclntsh.sl: Mismatched ABI. 64-bit PA shared
>library found in 32-bit link.
>
>And indeed:
>root@hohp11: [/orasw/base8/805/lib] file libclntsh.sl
>libclntsh.sl: ELF-64 shared object file - PA-RISC 2.0 (LP64)
>As well as all other libraries there.
>
>Is it possible to find 32-bit libraries?
They exist on my installation, although I have 64bit 8.1.6 installed:
$ find /bv/oracle-8.1.6-64bit/ -name libcl\* | xargs file
/oracle-8.1.6-64bit/OraHome1/lib/libclient8.a: archive file -PA-RISC1.1 relocatable library
/oracle-8.1.6-64bit/OraHome1/lib/libclntsh.sl.8.0: PA-RISC1.1 shared library -not stripped
/oracle-8.1.6-64bit/OraHome1/lib/libclntsh.sl: PA-RISC1.1 shared library -not stripped
/oracle-8.1.6-64bit/OraHome1/lib64/libclient8.a: archive file
/oracle-8.1.6-64bit/OraHome1/lib64/libclntsh.sl.8.0: ELF-64 shared object file - PA-RISC 2.0 (LP64)
/oracle-8.1.6-64bit/OraHome1/lib64/libclntsh.sl: ELF-64 shared object file - PA-RISC 2.0 (LP64)
Rich
--
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant | I speak for me, | 19055 Pruneridge Ave.
Development Alliances Lab| *not* HP | MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014
------------------------------
Date: Wed, 09 Aug 2000 16:38:15 GMT
From: vagabond_nomad@my-deja.com
Subject: Re: CGI/Pearl Interfacing w/ DOS Program Question
Message-Id: <8ms1dn$tk2$1@nnrp1.deja.com>
> Oysters make those. This is Perl. Saying 'Pearl' here is like stamping
> your forehead with NEWBIE in big, red letters. It's fine if you are,
but
> you don't have to advertise it quite so much.
>
Thanks. I realized recently that I've been spelling it incorrectly.
Thanks for the pointer, and even more thanks for letting me know
without making me feel like a complete and total idiot :^) Yes, I am
quite obviously very, very new to Perl...too obvious for my liking.
But anyway...
> Really? DOS programs don't run under Unix. (Not without something line
> WINE anyway.) And even if they did, giving Joe Webhead the ability to
> run programs via the web is generally a bad idea.
>
> Maybe you need to rethink your problem.
>
Perhaps a DOS emulator...(is that what WINE is?) would allow for the
DOS program to run on a Unix machine? The reason that this absolutely
has to be a DOS program running on a Unix server is because (1) they
want to run it on a Unix server in order to reach the largest possible
number of people, and (2) this DOS program is ultimately going to be a
component of a Win98 application but has only been compiled as a DOS
program in order to get it to run on the Unix machine.
The reason for doing all this is that they want beta testers to be able
to run this component via the web and report bugs in the logic and to
give feedback about ways to improve the process.
> > The DOS program will send output to the user's web browser that
> > will be displayed as HTML. The user will then enter some input
> > into the web browser, which will then be sent back to the DOS
> > program for processing.
> [etc., etc. ad naseum]
Exactly ;^)
>
> That's what CGI does, but typically internally, not by going out and
> running another application -- it's a potential security issue.. What
is
> this "DOS program" you're trying to run? Perhaps if you can provide
more
> details, the folks here can help you.
>
Hopefully the previous, large paragraph has made this more clear.
Essentially, this company I am working for is wanting to beta test a
component of their Win98 application via the web. So, they've compiled
this component as a DOS program in order to get it to run on the Unix
machine. When the application actually goes live, it will all occur in
a Win98 interface, but until then this is how they want to get feedback.
Is this the kind of detail that you were wanting? So then, assuming
that the DOS program runs in an emulator of some sort (suggestions on
emulators?), then how exactly would I get this CGI/Perl script to
interface with the DOS program? I need to be able to:
1. Start the program.
2. Receive its output.
3. Format its output as HTML.
4. Send this output HTML to the user's browser.
5. Take the user's browser from the input and send it back to the DOS
program.
Note that we may just send this input back to the DOS program by
setting command line flags, which the executable will recognize. So
the first time we run the EXE, we'll do it without any parms.
Subsequent times we're thinking of running the EXE with the addition of
the appropriate command line flags. Unless anyone has any ideas about
a better way to do this within the constraints of a DOS program running
on a Unix machine :^)
6. The DOS program will process the new input.
7. Receive its output.
8. Format its output as HTML.
9. Send this output HTML to the user's browser, etc, etc, etc.
So, with this new information, does anyone have any ideas? Thanks in
advance.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 9 Aug 2000 15:17:01 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <8mrsld$p73$1@internal-news.uu.net>
Keith Calvert Ivey <kcivey@cpcug.org> wrote:
> I suppose the
> people who use ' (the Dutch?) are the most sensible there
In the Netherlands we are using (or at least were using when I last
was there), commas and dots ( fl 1.234,56 ).
Erik
------------------------------
Date: Wed, 09 Aug 2000 11:04:53 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <39918125.C2169114@rac.ray.com>
Erik van Roode wrote:
>
> Keith Calvert Ivey <kcivey@cpcug.org> wrote:
>
> > I suppose the
> > people who use ' (the Dutch?) are the most sensible there
>
> In the Netherlands we are using (or at least were using when I last
> was there), commas and dots ( fl 1.234,56 ).
>
How much is "one billion" there? In the US it's 1,000,000,000 but I
understand it's a different number altogether in UK and EU.
I don't suppose that there's any way that "locale" could cover that.
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: Wed, 09 Aug 2000 09:44:03 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <39918A52.52A5DDE9@stomp.stomp.tokyo>
Russ Jones wrote:
> Erik van Roode wrote:
> > Keith Calvert Ivey wrote:
> > > I suppose the people who use ' (the Dutch?) are the
> > > most sensible there
> > In the Netherlands we are using (or at least were using when I last
> > was there), commas and dots ( fl 1.234,56 ).
> How much is "one billion" there? In the US it's 1,000,000,000 but I
> understand it's a different number altogether in UK and EU.
> I don't suppose that there's any way that "locale" could cover that.
I have a very simple challenge for you, Mr. Jones, or any
others up to this simple challenge.
Using your keyboard, draw for me a picture of decimal point.
Godzilla!
So you are lazy. I will rock you anywho.
http://la.znet.com/~callgirl3/lazy.mid
------------------------------
Date: 9 Aug 2000 11:58:08 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <8ms2j0$ddq$1@provolone.cs.utexas.edu>
In article <39918A52.52A5DDE9@stomp.stomp.tokyo>,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>Using your keyboard, draw for me a picture of decimal point.
O.K.:
,d88b,
d888888b
88888888
Y888888P
"Y88P"
Did I zoom in too much?
- Logan
------------------------------
Date: Wed, 09 Aug 2000 10:07:47 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <39918FE3.61F65F90@stomp.stomp.tokyo>
Logan Shaw wrote:
> Godzilla!
> >Using your keyboard, draw for me a picture of decimal point.
> O.K.:
>
> ,d88b,
> d888888b
> 88888888
> Y888888P
> "Y88P"
>
> Did I zoom in too much?
> - Logan
No, you provided an incorrect answer, or picture
as the case might be. Nice ascii art though. I've
some x-rated ascii art. Wanna see? Have you noticed
it is impossible to create curves with computer
technology?
Think Mr. Shaw. I have provided a grammatical clue.
Draw for me decimal point.
Godzilla!
------------------------------
Date: Wed, 9 Aug 2000 19:20:15 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <Pine.GHP.4.21.0008091902060.23130-100000@hpplus03.cern.ch>
On Wed, 9 Aug 2000, Russ Jones wrote:
> How much is "one billion" there? In the US it's 1,000,000,000 but I
> understand it's a different number altogether in UK and EU.
Well, since you ask...
Within my lifetime, the US hordes have pretty-much trampled out the
original UK meaning of "billion", 10^12, for which the OED has a
citation back to 1690. In the 1989 edition, the OED was still
reporting the 10^12 meaning as the common British usage, with the US
one becoming "increasingly" predominant in Britain: frankly I'd say
that verdict was a bit behind the times even then.
But you see, we never really used the word "milliard", so it
was an easy battle when there was a practical need for the
quantity: "thousand million" hardly trips off the tongue.
My German colleagues had no doubt that Billion was 10^12, and
Milliarde 10^9.
This is also the case in current French, but I'm assured that it
hasn't always been the case: apparently there was a big debate about
it at some time in the past (19th Century??).
We now return you to your usual diet of perls... ;-)
------------------------------
Date: Wed, 9 Aug 2000 10:32:13 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <MPG.13fb357cc2ab4ab898ac4f@nntp.hpl.hp.com>
In article <m33dkf9ku6.fsf@netaxs.com> on 08 Aug 2000 23:25:53 -0400,
Walt Mankowski <waltman@netaxs.com> says...
> kcivey@cpcug.org (Keith Calvert Ivey) writes:
>
> > Walt Mankowski <waltman@netaxs.com> wrote:
> >
> > >Locales allow a
> > >programmer in the US to write
> > >
> > >$pi = 3.14159
> > >
> > >and a programmer in France to write
> > >
> > >$pi = 3,14159
> >
> > I have no experience with locales, but that's not what
> > perllocale says. What would the French programmer use
> > for a comma operator, then?
>
> DOH! You're right. Sorry about that. Perl, of course, thinks that
> the comma is an operator. It does work if you say
>
> $pi = "3,14159"
>
> because Perl will convert the string into a floating point.
I also have no experience with locales, and have none installed that I
can test with. But I wonder how the situation of (in a French locale,
say)
$pi = 3,14159;
is different from, in an English locale,
$pi = 3.14159;
I *can* test the following:
$pi = 3 .14159;
where the '.' is DWIMmed as string concatenation. By analogy, in order
to get the comma interpreted as a list operator, one might need white
space.
Maybe someone with an appropriate locale would be kind enough to say
what actually happens with commas. I can't figure it out by reading
perllocale. Oh, for a formal language spec! :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 9 Aug 2000 10:47:25 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <MPG.13fb390b9b4ef53798ac50@nntp.hpl.hp.com>
In article <3995afce.4827424@news.newsguy.com> on Wed, 09 Aug 2000
01:18:12 GMT, Keith Calvert Ivey <kcivey@cpcug.org> says...
> "Alan J. Flavell" <flavell@mail.cern.ch> wrote:
> >On Tue, 8 Aug 2000, Jürgen Exner wrote:
> >
> >> The vast majority of countries in particular in Europe uses a decimal comma
> >> instead of a decimal point. Japan (and some other FE countries) follow the
> >> US, there you are right.
> >
> >Maybe it's that the US follows Britain. But I would say that,
> >wouldn't I.
>
> But regardless of who's following, we both use the more
> sensible decimal separator. With decimal commas, you have
> to use semicolons for a simple list of numbers. Of course,
> we shouldn't be using either commas or periods for thousand
> separators, but those come up less often -- I suppose the
> people who use ' (the Dutch?) are the most sensible there
> (though the thin space and our beloved underscore are also
> possibilities).
As I said in another post, a decimal-point separator '.' is no less
subject to syntactic ambiguity than a decimal-comma separator ','.
String-concatenation operator as compared to expression separator.
> >Pity they can't get a sensible date format, though.
>
> Yours is just less unsensible than ours. Not many people use
> the sensible one.
How about 1 billion Chinese? The ISO-8601 standard -- 'the sensible
one' -- is the date-time notation used in China (and may have been
adapted from the Chinese standard representation, though I don't know
the history).
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 9 Aug 2000 17:46:03 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <8ms5cr$264$1@internal-news.uu.net>
Russ Jones <russ_jones@rac.ray.com> wrote:
> Erik van Roode wrote:
>>
>> In the Netherlands we are using (or at least were using when I last
>> was there), commas and dots ( fl 1.234,56 ).
>>
> How much is "one billion" there? In the US it's 1,000,000,000 but I
> understand it's a different number altogether in UK and EU.
1E6 miljoen
1E9 miljard
1E12 biljoen
> I don't suppose that there's any way that "locale" could cover that.
Scientific notation always works :) And locale might not cover
quotation marks either, one of the other things that seem to be
different everywhere.
Erik
------------------------------
Date: Wed, 09 Aug 2000 17:39:58 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: correction: sorting problem! output should be (a A Aa AA AaA AAa AAA).
Message-Id: <7fu2psgk75r9b9n9gdk6c3aieo8t14an2i@4ax.com>
On Wed, 09 Aug 2000 16:13:23 +0200, Erik van der Knaap
<eknaap@lucent.com> wrote:
> Anno Siegel wrote:
> >
> > Erik van der Knaap <eknaap@lucent.com> wrote in comp.lang.perl.misc:
> > >Folks,
> > >
> > >I want to sort a list in a special way. I want to sort an abbreviation list.
> > >@unsorted = qw(AA AAA aA a B C d E dD);
> > >
> > >And I want the output as:
> > >a aA AA AAA B C d dD E
...
> > sort { lc $a cmp lc $b or $a cmp $b } @unsorted;
> yep, I want something like this. (I will use this because the output looks better now).
...
> The problem is I want to sort with a lowercase (higher priority) priority and then Uppercase.
It doesn't look like it though :-)
>
> Your example worked of course for my list (stupid example of mine). I have a list of abbreviations and they must be
> sorted in a list. My output is still not correct:
> example of a correct list I want is: adm AdM ADM AddM ADdM etc.
>
> So first priority lower case, second uppercase.
Nope, because then 'd' < 'M' which means you get a different order then
you propose.
I've got one that works for both test cases, you might want to figure
out your own sort criteria :-)
#!/usr/bin/perl -w
use strict;
my @order = map { ($_, uc $_) } ('a'..'z');
my %ordinal;
@ordinal{ @order } = (1..@order);
while ( <DATA> ) {
my @unsorted = split;
chomp(my $result = <DATA>);
my @sorted = map $_->[-1] => sort {
$a->[0] cmp $b->[0] ||
$a->[1] <=> $b->[1] ||
$a->[2] cmp $b->[2] } map {
my $s; $s .= chr($ordinal{$_}) for split //;
[ substr($s, 0, 1), length $_, $s, $_ ];
} @unsorted;
print <<EOMSG;
Unsorted: @unsorted
Wanted : $result
Sorted : @sorted
EOMSG
}
__DATA__
AA AAA aA a B C d E dD
a aA AA AAA B C d dD E
AddM ADM AdM ADdM adm
adm AdM ADM AddM ADdM
--
Good luck,
Abe
------------------------------
Date: Wed, 09 Aug 2000 13:01:41 -0400
From: ZepHead <groovyt@erols.com>
Subject: Re: dropping space from begginning & end of a string
Message-Id: <groovyt-8510C3.13014109082000@news.erols.com>
In article <v3a3qSAGkqj5Ewix@worsdall.demon.co.uk>, Mark Worsdall
<linux@worsdall.demon.co.uk> wrote:
> Hi,
>
> I have this string:-
>
> my $string = ' hello todays world ';
>
> How could I drop the space from the beginning and the end?
use the function
SpacesBeGone()
perlfaq4 IIRC
------------------------------
Date: Wed, 09 Aug 2000 17:29:11 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Expert advise needed
Message-Id: <pq33ps88g0g80mfoj7vf951et8c4ogr9gc@4ax.com>
Denys Kotseba wrote:
>My boss got the idea to develop an application (potentially for sale) which
>would allow people with no technical knowledge create a web-shop.
What's a webshop?
>It would
>be running on server and accessed though a regular browser. I feel Perl is a
>good tool for this kind of task. He doesn't like the idea of writing it in
>Perl because we would have to give out the source code.
Perhaps he's a bit right. Installation of Perl for one script could be a
bit of a hassle for non-technical people.
Maybe you could lease it, instead of selling. You install it on your own
server, and other servers can pass their request to yours. It would need
customer customization though: each license it's own face.
Or, you can go the open-source road. Several companies already have. You
practically "give away" the program, but for a fee, you do the
installation, consulting and support. For examples, see Endyminion's
MailMan, <http://www.endymion.com/products/mailman/>, and MySQL
<http://www.mysql.com/support/>.
Companies, which will be your primary target, will gladly pay you to do
the installation, because otherwise they'd have to put some of their own
people on the job, which aren't free either, and who'll probably take a
lot more time to do it, than you would. In the end, it would probably
cost a lot more than just paying you to do it.
And, not to be ignored: if your product is pretty damn good, you'll earn
a decent, world wide reputation. Think MySQL, think Netscape (who in the
world has paid for their browser?), think RealAudio.
Finally, you can still do the prototyping in Perl, and port it to
another language in the end. Getting the behaviour right, even including
the porting to C once you know what you want, may be a lot easier than
writing it in C (or similar) from scratch.
--
Bart.
------------------------------
Date: Wed, 09 Aug 2000 16:28:50 GMT
From: Nick31 <nick31@my-deja.com>
Subject: failures in bigfltpm test during make test
Message-Id: <8ms0rn$tc8$1@nnrp1.deja.com>
I am installing Perl 5.6.0 on a SCO Openserver 5.0.4 system I have run
Configure and make, and during make test 1 test fails. I have isolated
the failure to bigfltpm.t tests 351-354 (output below). Is this a
problem that I can fix or something that I can safely ignore? Thanks
in advance for any help and suggestions!
...
ok 350
not ok 351
# '$x = new Math::BigFloat "-1";0+$x->fsqrt;' expected: /^(?i:0|\?NaNQ?)
$/ got: '-0.nan'
not ok 352
# '$x = new Math::BigFloat "-2";0+$x->fsqrt;' expected: /^(?i:0|\?NaNQ?)
$/ got: '-n.an'
not ok 353
# '$x = new Math::BigFloat "-16";0+$x->fsqrt;' expected: /^(?i:0|\?
NaNQ?)$/ got: '-n.an'
not ok 354
# '$x = new Math::BigFloat "-123.456";0+$x->fsqrt;' expected: /^(?i:0|\?
|NaNQ?)$/ got: '-n.an'
ok 355
...
--
Nick
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 09 Aug 2000 10:16:46 -0500
From: Kevin Halverson <bunnyman77@hotmail.com>
Subject: feeding output of grep to a variable.
Message-Id: <399175DD.AC8D4B72@hotmail.com>
Greetings to the Perl Gods!!
I humbly through myself on your mercy and infinite wisdom to assist
me. I'm trying to feed the results of the grep command in a list so I
can use 'split' on the outcome. I'm trying to get the PIDs of the nfsd
processes.
#!/usr/bin/perl
@procs = grep /nfsd/, `ps -ef`;
#gets lines just with nfsd
@rc = grep /[1-9]/, split(/ /, $procs);
#greps out PID numbers...supposedly
print "$procs\n";
When I run this I get no output. Looking in my perl book it says the
output has to be a declared variable before 'split' will work on it
i.e. output from a command can't be put into a variable for 'split' to
work on.
Is there a way to get the output of a command to be put into a list
on which 'split' can be used??
-Thanks, Kev!!
------------------------------
Date: Wed, 09 Aug 2000 15:53:20 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: feeding output of grep to a variable.
Message-Id: <slrn8p2vtc.l3m.rgarciasuarez@rafael.kazibao.net>
Kevin Halverson wrote in comp.lang.perl.misc:
>Greetings to the Perl Gods!!
>
> I humbly through myself on your mercy and infinite wisdom to assist
>me. I'm trying to feed the results of the grep command in a list so I
>can use 'split' on the outcome. I'm trying to get the PIDs of the nfsd
>processes.
>
>#!/usr/bin/perl
>
>@procs = grep /nfsd/, `ps -ef`;
>#gets lines just with nfsd
@procs is an array of lines
>@rc = grep /[1-9]/, split(/ /, $procs);
>#greps out PID numbers...supposedly
$procs is a scalar variable that has nothing to do with @procs
As the PID number is usually in a specified column (the second one on my
RedHat), why not doing
for (@procs) {
my @pid = split /\s+/,$_,3;
print "$pid[1]\n";
}
And, BTW, generally comments are above the lines they concern. This is
more readable.
--
Rafael Garcia-Suarez
------------------------------
Date: 09 Aug 2000 10:41:16 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: feeding output of grep to a variable.
Message-Id: <m3g0oebfxf.fsf@dhcp11-177.support.tivoli.com>
Kevin Halverson <bunnyman77@hotmail.com> writes:
Let's clean this up a bit and see if the error reveals itself...
> #!/usr/bin/perl
#!/usr/bin/perl -w
use strict;
>
> @procs = grep /nfsd/, `ps -ef`;
my @procs = grep /nfsd/, `ps -ef`;
> #gets lines just with nfsd
> @rc = grep /[1-9]/, split(/ /, $procs);
my @rc = grep /[1-9]/, split(/ /, $procs);
> #greps out PID numbers...supposedly
> print "$procs\n";
Running this gives (something similar to):
Global symbol "$procs" requires explicit package name at -e line 6.
Global symbol "$procs" requires explicit package name at -e line 8.
Execution of -e aborted due to compilation errors.
Ah-ha! $procs is a scalar, while @procs is an array. This isn't what
you want. While we're there, grepping for digits is not going to be
very useful as the "ps -ef" output has several fields with digits.
Instead, we need to grab the specific field that we want, in this
case, the second field.
#!/usr/bin/perl -w
use strict
my @procs = grep /nfsd/, `ps -ef`; # grab any ps line with "nfsd"
my @pids = map { (split)[1] } @procs; # grab the second field of each
print "@pids\n";
Hope that helps....
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 09 Aug 2000 17:54:26 +0100
From: nobull@mail.com
Subject: Re: files transferred by socket?
Message-Id: <u9k8dqtlx9.fsf@wcl-l.bham.ac.uk>
u8526505@ms27.hinet.net () writes:
> I tried to send files from socket by this way
>
> server:
> open(FILE,$file) or die "error";
> binmode(FILE);
> while(<FILE>){
> print $sock $_;
> }
> close FILE;
>
> client:
> open(NEWFILE,">newfile");
> while(defined ($_=<$sock>)){
> print NEWFILE $_;
> }
> close (NEWFILE);
>
> the data that client receive is always larger than the original one.why?
> I tried both text and binary file and the result is the same.
> If I comment the binmode then it works for text file but not binary.
> Is there a general way for both types of files?
Make all four file handles binmode.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
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 3964
**************************************