[7587] in Perl-Users-Digest
Perl-Users Digest, Issue: 1213 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 22 11:27:52 1997
Date: Wed, 22 Oct 97 08:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 22 Oct 1997 Volume: 8 Number: 1213
Today's topics:
Re: [Reposted due to Enlow UCE cancel]: Re: Help: sybpe (EMarkert)
Re: Can I use DBM in windows NT ???? (Jeremy D. Zawodny)
Re: Command Pipes in Perl Win32 (Jeremy D. Zawodny)
context (David Siebert)
Re: context (Honza Pazdziora)
date in chat script <racioppi@ptd.net>
Re: Getting PERL for NT and installing it. (Parillo)
Re: help solving this beginning 'perl' program <seay@absyss.fr>
Re: How to set perl via Fastrack Server (Jeremy D. Zawodny)
How to sort a multi-dim array ??? <vincent.rabah@hol.fr>
Re: How to sort a multi-dim array ??? (Mike Stok)
Re: How to sort a multi-dim array ??? (Mick Farmer)
Move specified number of variables into one array??? <Michael.Bach@kst.siemens.de>
No output from a Perl script <pedro.ascenso@mail.telepac.pt>
Re: Perl Bug Report <ghowland@hotlava.com>
Re: perl editor (Toutatis)
Re: perl editor <wmeahan@ford.com>
Re: Perl Pad function (Jeremy D. Zawodny)
Re: Perl Pad function (Mike Stok)
Re: Perl Pad function <seay@absyss.fr>
Re: Perl Pad function (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: Perl5.003 source ??? (Jeremy D. Zawodny)
Re: Quest for knowlege part one - Windows question. <camerond@mail.uca.edu>
Re: WebSite: How to get Perl to execute in Browser (Jeremy D. Zawodny)
Re: Why doesn't this work? <seay@absyss.fr>
Re: Why doesn't this work? <seay@absyss.fr>
Re: Windoze question.. (Jeremy D. Zawodny)
Year 2000 for GNU-Perl5 <mpchandler@mema.mail.fedex.com>
Re: Year 2000 for GNU-Perl5 (Jeremy D. Zawodny)
Re: Year 2000 for GNU-Perl5 <seay@absyss.fr>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Oct 1997 13:10:32 GMT
From: emarkert@aol.com (EMarkert)
Subject: Re: [Reposted due to Enlow UCE cancel]: Re: Help: sybperl 2.08 with RedHat 4.2
Message-Id: <19971022131000.JAA13804@ladder01.news.aol.com>
Let's not forget that you need the Open Client software from sybase. Without
this you won't have the C libraries necessary to compile sybperl
------------------------------
Date: Wed, 22 Oct 1997 12:54:36 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Can I use DBM in windows NT ????
Message-Id: <344ef779.431418837@igate.hst.moc.com>
[cc'd automagically to original author]
On Mon, 20 Oct 1997 03:26:19 GMT, bslee@pl.jaring.my (B.S.LEE) wrote:
>Usually, DBM(Database Management) is used under UNIX system. But my
>web server is WindowsNT 4.0. So, can I use DBM to maintain a database
>server under WindowsNT 4.0. I personally don't want to use SQL or MS
>Assess because I just want to maintain a small size of web database.
>If anybody have any good suggestions, please help me.
There ought to be SDBM support in your Win32 Perl.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 22 Oct 1997 13:01:19 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Command Pipes in Perl Win32
Message-Id: <3450f88c.431693953@igate.hst.moc.com>
[cc'd automagically to original author]
On 21 Oct 1997 22:29:45 GMT, cnastans@mipos2.intel.com (Craig
Nastanski) wrote:
>Is there any way I can compensate for the innefficiencies of Win32's pipes?
And I suppose making fewer programs handle the data is not an option?
Other that than, I'm not sure...
>Can
>I simulate the equivalent Unix behavior using Perl? Perl Win32 doesn't support
>the fork command (why?)
Because it's not built-in to the OS like it is in Unix. Developing a
custom fork() implementation for Win32 is something to take lightly. I
can't imagine any of the Perl Porters jumping to the task.
It's really a failing on the part of Microsoft if you ask me. If they
wanted to make an 'easy' migration path from Unix to NT, they'd have
implemented more of the critical system calls (like fork()).
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: 22 Oct 1997 13:29:59 GMT
From: dsiebert@gate.net (David Siebert)
Subject: context
Message-Id: <62kv4n$1f6m$1@news.gate.net>
I have looked in all my books and have not been able to find an xample of how
to force a var into a string context. Help please
------------------------------
Date: Wed, 22 Oct 1997 14:51:39 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: context
Message-Id: <adelton.877531899@aisa.fi.muni.cz>
dsiebert@gate.net (David Siebert) writes:
> I have looked in all my books and have not been able to find an xample of how
> to force a var into a string context. Help please
$result = $var . '';
Hope this helps.
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: Wed, 22 Oct 1997 10:19:07 -0400
From: Randy <racioppi@ptd.net>
Subject: date in chat script
Message-Id: <344E0B5B.1494@ptd.net>
I am not really a perl programmer, and I am having problems getting my
chat script to display the proper time when a message is posted. The
portion of the script that refers to the time is below. I would very
much appreciate any help you guys could provide.
The time it shows when a message is posted is (12:am)
Thank You,
Randy
#############################################################
# Section 3: get the time and format to look nice
$now_string = localtime;
@thetime = split(/ +/,$now_string);
@theclock = split(/:/,$thetime[3]);
$ampm = 'am';
if ($theclock[0] > 11)
{ $ampm = 'pm'; }
if ($theclock[0] == 0)
{ $theclock[0] = 12; }
if ($theclock[0] > 12)
{ $theclock[0] -= 12; }
else
{ $theclock[0] += 0; }
#############################################################
------------------------------
Date: 22 Oct 1997 11:58:10 GMT
From: lparillo@newshost.li.net (Parillo)
Subject: Re: Getting PERL for NT and installing it.
Message-Id: <62kpoi$csu$1@news01.li.net>
I like http://www.activeware.com also
: Julio Rafael Escobar <escobar@oxy.edu> writes:
: :I am very interested in learning PERL. I have written some batch files,
: :but I find that they are limited in power. Can someone tell me how I
: :can get PERL for NT 4.0 and install it. I may have it in the NT
: :Resource Kit already, but I don't know how to get it started: This
: :means installing it and getting into a code window where I can start
: :writing code.
: Try http://mox.perl.com/index.html or www.perl.com.
------------------------------
Date: Wed, 22 Oct 1997 15:05:16 +0200
From: Doug Seay <seay@absyss.fr>
To: Toutatis <toutatis@_SPAMTRAP_toutatis.net>
Subject: Re: help solving this beginning 'perl' program
Message-Id: <344DFA0C.63E0F988@absyss.fr>
[posted and mailed]
Toutatis wrote:
>
> In article <62ju0e$odt@q.seanet.com>, "Allen Evenson" <ase@seanet.com> wrote:
>
> > HTH, (Remember: TMTOWTDI)
>
> Eh...
> Happy Time Hacking,
> ? ? ? Of Ways To Do It
> Help me out
HTH = Happy To Help --or-- Hope This Helps
TMTOWTDI = There's More Than One Way To Do It
The later is the (un?)official Perl motto.
- doug
------------------------------
Date: Wed, 22 Oct 1997 13:05:29 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: How to set perl via Fastrack Server
Message-Id: <3452f9e0.432034122@igate.hst.moc.com>
[cc'd automagically to original author]
On Wed, 22 Oct 1997 16:01:43 +0700, Adm_bbl
<adm_bbl@mozart.inet.co.th> wrote:
>Hello
>I want to know ,How to install perl on windows95 to work with Netscape
>Fastrack Server 2.0(for win95)
In a nutshell:
(1) Install FastTrack
(2) Install Perl
(3) Check .pl file association as explained in Netscape's server
documentation.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 22 Oct 1997 14:38:52 +0200
From: Vincent RABAH <vincent.rabah@hol.fr>
Subject: How to sort a multi-dim array ???
Message-Id: <344DF3DB.DC324040@hol.fr>
my @tab=( [10,4,4],
[5,3,5],
[4,3,6],
[4,3,7],
[10,4,8],
[5,5,7],
[10,6,6],
[15,7,5],
[10,8,5],
[5,9,5],
[4,10,5]);
I need to sort this multi-dimensional array, on the 2nd column+3nd
column, ie :
@tab after sorting must be :
(
[5,3,5],
[4,3,6],
[4,3,7],
[10,4,4],
[10,4,8],
[5,5,7],
[10,6,6],
[15,7,5],
[10,8,5],
[5,9,5],
[4,10,5]
);
How to ??? ...
------------------------------
Date: 22 Oct 1997 14:02:57 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: How to sort a multi-dim array ???
Message-Id: <62l12h$alq@news-central.tiac.net>
In article <344DF3DB.DC324040@hol.fr>,
Vincent RABAH <vincent.rabah@hol.fr> wrote:
>my @tab=( [10,4,4],
> [5,3,5],
> [4,3,6],
> [4,3,7],
> [10,4,8],
> [5,5,7],
> [10,6,6],
> [15,7,5],
> [10,8,5],
> [5,9,5],
> [4,10,5]);
>
>I need to sort this multi-dimensional array, on the 2nd column+3nd
>column, ie :
You could try
@tab = sort {$a->[1] <=> $b->[1] || $a->[2] <=> $b->[2]} @tab;
and check the perl FAQ if you want to do more elaborate sorts. This works
'cos @tab is a list of references to lists, so $a and $b will be
references to lists in the block in the sort, so ->[$index] can be used to
get at the apporpriate elements.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Wed, 22 Oct 1997 13:52:49 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: How to sort a multi-dim array ???
Message-Id: <EIGH81.8Mv@mail2.ccs.bbk.ac.uk>
Dear Vincent,
Here's what you want. If the elements in the second
column are equal, then the elements in the third column
are compared.
@sorted = sort { $$a[1] <=> $$b[1] || $$a[2] <=> $$b[2] } @unsorted;
Regards,
Mick
------------------------------
Date: Wed, 22 Oct 1997 15:52:45 +0200
From: Michael Bach <Michael.Bach@kst.siemens.de>
Subject: Move specified number of variables into one array???
Message-Id: <344E133D.4B1F@kst.siemens.de>
Hi there...
I have the following problem:
1) I get a certain number of arguments from a HTML-form via CGI.pm
2) I know the number of arguments
3) I do a loop to work on each of the arguments using the number of
arguments
... this is where my problem comes in... I guess it's probably sheer
stupidity:
I would like to do something like this:
while ( $bla != $numberOfArguments) {
do something with @argument[$bla] ;
$bla++;
}
The problem is that I get variables $argument1 - $argumentn and can't
seem to figure out how to get all those single variable into one
array... constructs like $argument$bla don't seem to work.
Help would be appreciated!
Regards from Germany
Mike
------------------------------
Date: 22 Oct 1997 00:18:20 GMT
From: "Pedro Ascenso" <pedro.ascenso@mail.telepac.pt>
Subject: No output from a Perl script
Message-Id: <01bcde78$70b23420$35ca41c2@nop10555>
Hello, thanks for reading my message.
I've wrote a Perl script that updates a database file. When I click on the
submit button I want the script to be executed but I don't want to output
anything to the browser.
In my script I don't have any print statements, so I get the message
"Document contains no data". How do I do to execute the script and stay on
the same page.
Thanks again.
Pedro Ascenso
pedro.ascenso@mail.telepac.pt
------------------------------
Date: Tue, 21 Oct 1997 08:40:10 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: Re: Perl Bug Report
Message-Id: <344C5C5A.473C@hotlava.com>
Charles Margolin wrote:
>
> Gary Howland wrote:
> >
> > Here's a bug in Perl. Quite a nasty one too, since it changes values
> > for subsequent calls of a function:
> >
> > use strict;
> >
> > sub f
> > {
> > my $x = shift;
> > my $y = shift;
> > my $z = $y->{'1'} if defined $y;
> > $z = $x unless defined $z;
> >
> > print "$x, $z\n";
> > }
> >
> > f("a");
> > f("b");
> >
> > I would expect the output:
> >
> > a, a
> > b, b
> >
> > but instead I get:
> >
> > a, a
> > b, a
> >
>
> Not a bug. Your statement
> my $z = $y->{'1'} if defined $y;
> would do two things if it had been executed: declare the lexical
> $z and set its value. Here it did neither, so $z is a package
> "global" variable. It was set to "a" on the first call, so it
> is still defined in the second call.
Ah, OK. But this should produce a warning should it not? (since I
always use -w and use strict).
Gary
--
pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
.
.
.
.
.
.
.
.n
n
t
p
f
o
o
d
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
------------------------------
Date: 22 Oct 1997 12:18:28 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: perl editor
Message-Id: <toutatis-ya023180002210971418290001@news.euro.net>
In article <344DCEF0.2A258BCF@absyss.fr>, Doug Seay <seay@absyss.fr> wrote:
> [posted and mailed]
>
> Vladimir Afanasiev wrote:
> >
> > Where I can download freeware or shareware editor for PERL program
> > (Win'95)?
>
> What do you mean? Just just blocnote, edit, or any other ASCII editor
> that you happen to like. Perl doesn't require any magical editors.
But a nice editor like xemacs DOES help a *lot*.
--
Toutatis
------------------------------
Date: Wed, 22 Oct 1997 09:06:35 -0400
From: Bill Meahan <wmeahan@ford.com>
To: Vladimir Afanasiev <afan@elnet.msk.ru>
Subject: Re: perl editor
Message-Id: <344DFA5B.79AC@ford.com>
Vladimir Afanasiev wrote:
>
> Where I can download freeware or shareware editor for PERL program
> (Win'95)?
> Reply via email please.
Here we go again!
ARRRRGH! Not another editor-war troll!
After 30+ years of programming (starting with IBM 1620 machine language
entered through the front-panel switches), I've adopted the following,
highly cynical, biased-as-hell curmudgeonly views on "the best" of
anything, particularly editors:
1) **There is no "best" editor** (or programming language or PDA, or
Operating system, or GUI, or whatever) in any abolute or abstract sense.
There is only the editor that is "best" for YOU IN YOUR SITUATION.
2) Number of features, size, speed, number of existing users etc. are
all interesting, possibly even useful data points but ultimately
unpersuasive in themselves.
3) The editor that <name of net.god> thinks is best may well be the
very, very best editor for **them** but that doesn't mean it's the best
for **you** regardless of how forcefully the net.god and his/her
disciples argue for it.
4) Different people have different "mental models" of how the act of
editing takes place. This is a product of their previous experience,
neural organization, personality and a host of other considerations
having nothing whatsoever to do with code size, response time, extension
language or the other accidentals these editior wars tend to focus on.
Thus if your mental model of the editing process tends to separate
editing into different classes of actions only one of which should take
place at a time, then a "modal" editor (e.g. vi and its kin) is probably
a very good choice.
On the other hand, if you see editing as an continuous flow of "typing"
interspersed with occasional commands, then a "modeless" editor (e.g.
emacs and its kin) may be the better choice.
This choice of "moded" versus "modeless" is probably the hardest and
most basic choice since all the other features in the world will NOT
overcome the pain and suffering forced upon you by an editor that
operates in a modal manner if your brain operates modeless (or vice
versa).
BTW, some of us shift mental models depending on the situation at hand:
for large-scale editing I work better with a modeless editor so I tend
to use emacs or one of its kin. OTOH if I need to quickly correct a
simple typo or just replace a simple string, I'm already operating in a
defacto "fix-it mode" so I'm more likely to grab plain-vanilla vi. Go
figure.
5) Feature sets, like color syntax highlighting, syntax direction, tags,
class hierarchies dog walking, baby changing and ego stroking are all
really *nice* features and can prove quite useful IF (and I do mean IF)
they are implemented in a way that makes sense to YOU and don't get in
the way of doing the basic function of editing text.
However, the usefulness of any given feature set (or individual feature)
greatly depends on how often you're going to do anything that uses it.
If you sit in front of a tube and grind code 6-20 hours per day every
working day, they may be a whole lot more helpful than if you whack out
a 20-line script once every fortnight or two.
If you **do** spend 6-20 hours per day in front of ANY editor, that
editor will become either the "best" editor in existance OR the worst
piece of dreck in computerdom (from **your** perspective). Doing the
same thing over and over and over tends to develop "muscle memory" so
that your body does things automatically without requiring
conscious thought. At that point, any argument about how intuitive or
not some particular operation is moot since the muscles in the wrists
and fingers have long since overridden the brain. (Case in point: MS
Word is pretty clearly a lot more "intuitive" than Word Perfect 4.2 for
DOS but a lot of the secretaries and clerks around here took an
inordinately long time to migrate since they had to retrain their
fingers to not be hitting various "F-key" combinations to peform
relatively simple tasks).
6) If your boss dictates use of a given tool in the name of
"commonality" or if neither you nor your company is willing to spend
whatever it takes to get/install/maintain your editor-of-choice (and,
yes, even "free" editors have a cost in terms of time spent installing,
customizing or upgrading, disk space etc.) then all other considerations
do not apply. You use what you are permitted to use - sooner or later
you'll no longer care since you will either have become used to it or
will have quit and found another job.
Specifically addressing Perl: perl source is just plain old 7-bit
USASCII text. Thus **ANY** editor that can enter and edit plain old
7-bit USASCII text can be used for Perl development. No special editor
is required, period. You could, in principle, even develop Perl programs
using punched cards (probably have to use an 029 punch since an 026
doesn't support the full character set) or paper tape on an ASR33 or -35
though you'd have to have one hell of a strange mental model to prefer
these methods :-)
So as the editor religious wars rage, just take whatever editor you like
to use (even a wordprocessor if you save in "DOS Text" mode) and go out
and develop something useful. In the end, that's the object of the
whole exercise.
For the record, I mostly use Emacs (GNU on Unix, JED and NotGNU on PCs),
plain-vanilla vi on Unix systems, Notepad on Windows and whatever is
built into the "integrated development environment" I'm using at the
moment. I have used 026 and 029 keypunches, ASR33 teletypes, ed, edlin,
ex, Wordstar, brief, WordPerfect, MS Word and even a purely home-grown
"full screen editor" at various times in my career. Got my work done
with all of them - you can too!
--
Bill Meahan wmeahan@ford.com
Ford Motor Company -- Operational Support Tools
Not an official statement of Ford Motor Company or anyone else
except the author.
------------------------------
Date: Wed, 22 Oct 1997 13:07:06 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Perl Pad function
Message-Id: <3453fa5a.432156117@igate.hst.moc.com>
[cc'd automagically to original author]
On Wed, 22 Oct 1997 10:59:25 GMT, gmpieri@carroll.com (George Pieri)
wrote:
>I wanted to left pad or right pad a string , so that the string would
>be x characters wide. As far as I can see perl doesn't seem to have a
>built in pad function
>
>e.g.
> lpad($str,"0",15) ; # left pad the string with 0s
>
>It looks like I can use the pack function to do padding as described
>above but I wanted to make sure that no other better function exists.
You're correct. There isn't a pad() function. Pack ought to fit the
bill.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: 22 Oct 1997 13:52:56 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Perl Pad function
Message-Id: <62l0fo$9va@news-central.tiac.net>
In article <EIG9CD.FA7@nonexistent.com>,
George Pieri <gmpieri@carroll.com> wrote:
>I wanted to left pad or right pad a string , so that the string would
>be x characters wide. As far as I can see perl doesn't seem to have a
>built in pad function
>
>e.g.
> lpad($str,"0",15) ; # left pad the string with 0s
>
>It looks like I can use the pack function to do padding as described
>above but I wanted to make sure that no other better function exists.
You can use the sprintf function which is described in the perlfunc man
page in many cases. It's descended from C's *printf routines where a
template string uses sequences beginning with % to specify how arguments
are formatted, for example
$val = 123;
$val = sprintf '%015d', $val;
leaves $val containing the string 000000000000123. Alternatively you can
roll your own padding functions using the x operator to replicate
character strings and the length operator to determine the length of the
string to be padded.
As it's perl there's more than one way to do it.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Wed, 22 Oct 1997 15:18:48 +0200
From: Doug Seay <seay@absyss.fr>
To: George Pieri <gmpieri@carroll.com>
Subject: Re: Perl Pad function
Message-Id: <344DFD38.78A5CE70@absyss.fr>
[posted and mailed]
George Pieri wrote:
>
> I wanted to left pad or right pad a string , so that the string would
> be x characters wide. As far as I can see perl doesn't seem to have a
> built in pad function
>
> e.g.
> lpad($str,"0",15) ; # left pad the string with 0s
>
> It looks like I can use the pack function to do padding as described
> above but I wanted to make sure that no other better function exists.
True, but building one is trivial
sub lpad($$$)
{
my ($string, $pad, $len) = @_;
my $buffer = ($pad x $len) . $string;
substr($buffer, -$len);
}
- doug
------------------------------
Date: Wed, 22 Oct 97 10:16:39 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Perl Pad function
Message-Id: <344e0d24$2$ofn$mr2ice@speaker>
In <3453fa5a.432156117@igate.hst.moc.com>, on 10/22/97 at 01:07 PM,
zawodny@hou.moc.com (Jeremy D. Zawodny) said:
+-----
| > lpad($str,"0",15) ; # left pad the string with 0s
| >It looks like I can use the pack function to do padding as described
| >above but I wanted to make sure that no other better function exists.
| You're correct. There isn't a pad() function. Pack ought to fit the bill.
+--->8
sub lpad { ($_[1] x ($_[2] - length($_[0])) . $_[0]; }
(This, of course, omits boundary cases such as the string length being <= the
padded length, missing arguments, etc.)
TMTOWTDI, of course: I usually "inline" one with e.g. `substr("00000000$x",
-8)' (padded size 8 in this case, obviously).
--
brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) KF8NH
Warpstock '97: OS/2 for the rest of us! http://www.warpstock.org
Memo to MLS: End The Burn Scam --- Doug Logan MUST GO! FORZA CREW!
------------------------------
Date: Wed, 22 Oct 1997 13:03:04 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Perl5.003 source ???
Message-Id: <3451f92c.431854043@igate.hst.moc.com>
[cc'd automagically to original author]
On 21 Oct 1997 22:59:02 GMT, David Mayerlen <tbag@interlog.com> wrote:
> I can't seem to find the source for perl5.003 anywhere. I need to recompile
>my AIX perl executable. Obviously something has been deemed wrong with
>perl5.003 because it can no longer be found in CSPAN but perl5.002 and
>perl5.004 are available!
Why not use 5.004 anyway? Is there something wrong with it?
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Mon, 20 Oct 1997 09:36:38 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Quest for knowlege part one - Windows question.
Message-Id: <344B6C75.F5279699@mail.uca.edu>
Dan Norcott wrote:
> <grovelling snipped>
> I've got a PC with Win95, and an account with a service provider who allows
> me to upload my own
> scripts. This I have done, and it works lovely, but it isn't perfect.
> <more snipped>
> Ideally, I would like to be able to run my scripts from a web page on my
> own hard drive - is there any
> way to do this? My scripts are all invoked by forms on the web, and I
> don't see how I could get something
> similar to work on my PC.
>From another relative newbie: You could set up a webserver on your Win95
machine and use it for local access only, it's not too hard to do. However, you
must keep in mind that not all Perl is functional on Win95 (I'm assuming that
your ISP is using a Unix box). You will have to use some workarounds for things
that work perfectly well in Unix. That having been said, there are workarounds
for just about everything, and these will transport back to a Unix box, AFAIK.
> If anybody knows any ways to do this, or any
> solution, however strange,
> then I would be eternally grateful if you would email me at
> dagon@dagon.co.uk.
>
I would be eternally grateful if you would read the newsgroup for my answer,
and if you want to discuss it further, you can email me.
> Thanking you in anticipation for your godlike intervention,
> Dan Norcott.
>From a novice god-in-(self)training,
Cameron Dorey
camerond@mail.uca.edu
------------------------------
Date: Wed, 22 Oct 1997 12:53:08 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: WebSite: How to get Perl to execute in Browser
Message-Id: <344df700.431297883@igate.hst.moc.com>
[cc'd automagically to original author]
On Sun, 19 Oct 1997 22:18:05 -0400, Deborah Jean Schmid
<deb.schmid@mindspring.com> wrote:
>Howdy all.
>I have WebSite 1.1 running under Win95 and I can't get
>my perl scripts to run in the browser.
[snip]
>I have a feeling I'm missing something simple, but I've read
>FAQ's and such until my eyes are sore.
If you believe that Perl is going to run "in the browser", then you
have overlooked something simple.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 22 Oct 1997 15:13:23 +0200
From: Doug Seay <seay@absyss.fr>
To: Gerben Wierda <G.C.Th.Wierda@AWT.nl>
Subject: Re: Why doesn't this work?
Message-Id: <344DFBF3.69188140@absyss.fr>
[posted and mailed]
Gerben Wierda wrote:
>
> When I run
>
> ===========================================
> #! /usr/local/bin/perl
>
> my $path = 'fred';
> use constant DBDIR1 => $path;
> use constant DBDIR2 => "barney";
> use constant USERNAME => scalar getpwuid($<);
>
> warn "Expected output, fred, barney and your username all on one line\n";
> warn "@{[ DBDIR1 ]}, @{[ DBDIR2 ]}, @{[ USERNAME ]}\n";
> ===========================================
>
> I get
>
> ===========================================
> Expected output, fred, barney and your username all on one line
> , barney, gerben
> ===========================================
Tom Phoenix will correct me if I'm wrong, but I think the problem is
that constants are done immediately (think BEGIN block). This means
that the
my $path = 'fred';
line has been converted to byte code, but hasn't been run yet. The "use
constant" is seen, the constant magic is done, and the compiler
continues. Note that $path doesn't "exist" yet, so it doesn't have any
value. Only when everything has been compiled does execution start.
Here the byte code for $path='fred' is executed and $path is given a
value, but this is too late to affect the constant defintion of DBDIR1.
I think that you canfix this with
BEGIN { my $path = 'fred'; }
use constant DBDIR => $path;
because the BEGIN block will cause $path to be given a value right away,
so $path will be defined with DBDIR needs to use its value.
- doug
------------------------------
Date: Wed, 22 Oct 1997 15:48:34 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Why doesn't this work?
Message-Id: <344E0432.67493B0A@absyss.fr>
Doug Seay wrote:
> BEGIN { my $path = 'fred'; }
> use constant DBDIR => $path;
Guy Decoux pointed out my brain damage in email. I'd like to public fix
this to avoid the propagation of wrong information.
my $path;
BEGIN { $path = 'fred'; }
use constant DBDIR => $path;
Boy do I feel dumb. Thanks Guy.
- doug
------------------------------
Date: Wed, 22 Oct 1997 12:57:35 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Windoze question..
Message-Id: <344ff7cd.431503138@igate.hst.moc.com>
[cc'd automagically to original author]
On 20 Oct 1997 11:52:32 GMT, Janne.Leppanen@metla.fi (Janne Leppdnen)
wrote:
>Does anyone know can I automate installation of printer drivers with perl?
See below...
>Can I handle program groups with it? (the startup-folder for example)
Since they're just files and directories, I don't see why not.
>Can I automate installation of stupid programs like Netscape,Acrobat viewer
>somehow?
No, you can only automate the installation of non-stupid programs. :-)
Seriously, though, many installation programs let you create a custom
.INI or .INF file so that it can be run in a "hands off" mode. Is that
what you're looking for?
>Under Windoze NT,95 and 3.1...
>I'll have to do those for near 200 machines so please!!
>
>Or any other suggestion of net configuration of those machines.
How about using Visual Test from Rational Software? That's how folks I
know are able to automate otherwise interactive processes on 95 and
NT.
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 22 Oct 1997 06:59:23 -0500
From: Michael P Chandler <mpchandler@mema.mail.fedex.com>
Subject: Year 2000 for GNU-Perl5
Message-Id: <344DEA9A.C22076E7@mema.mail.fedex.com>
Is there a site/page/etc where I can find out if Perl5 (gnu version),
or Perl5 in general, is Year 2000 compliant???
I understand many considerations are hardware/OS dependent,
but I'm concerned about getting any patches/fixes if need-be.
------------------------------
Date: Wed, 22 Oct 1997 13:11:22 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Year 2000 for GNU-Perl5
Message-Id: <3454fac1.432258905@igate.hst.moc.com>
[cc'd automagically to original author]
On Wed, 22 Oct 1997 06:59:23 -0500, Michael P Chandler
<mpchandler@mema.mail.fedex.com> wrote:
> Is there a site/page/etc where I can find out if Perl5 (gnu version),
> or Perl5 in general, is Year 2000 compliant???
>
> I understand many considerations are hardware/OS dependent,
> but I'm concerned about getting any patches/fixes if need-be.
Unfortunately, searching http://www.perl.com/ for '2000' or '1900' or
'compliant' doesn't turn up much. :-(
However, if you code properly, your programs will not break. The only
gotcha in Perl is that many of the time/date functions return the
century - 1900. Simply adding 1900 yields a 4-digit date.
Note the difference between that and having it roll to '00' at the
year 2000. Perl will see it as 100.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 22 Oct 1997 15:25:47 +0200
From: Doug Seay <seay@absyss.fr>
To: Michael P Chandler <mpchandler@mema.mail.fedex.com>
Subject: Re: Year 2000 for GNU-Perl5
Message-Id: <344DFEDB.68FEB59E@absyss.fr>
[posted and mailed]
Michael P Chandler wrote:
>
> Is there a site/page/etc where I can find out if Perl5 (gnu version),
> or Perl5 in general, is Year 2000 compliant???
>
> I understand many considerations are hardware/OS dependent,
> but I'm concerned about getting any patches/fixes if need-be.
RTFM/RTFfaq
perlfaq4.pod:=head2 Does Perl have a year 2000 problem?
"perldoc perlfaq4" should do the trick.
And what is "Perl5 (gnu version)"? The folks at GNU have done a lot of
good work, but they have never touched Perl. There is one and only one
"version" and that is Larry Wall's (the author of Perl). While he lets
others do the day-to-day stuff, he is still the spiritual leader of
Perl[*]. Whoever told you that you had a "gnu version" was either
misinformed or trying to sell you something. Try "perl -v" to find out
what you really have.
- doug
[*] He is our "leader" as much as we have one, and he seems to be fairly
spiritual.
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1213
**************************************