[23597] in Perl-Users-Digest
Perl-Users Digest, Issue: 5804 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 14 14:10:47 2003
Date: Fri, 14 Nov 2003 11:10:21 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 14 Nov 2003 Volume: 10 Number: 5804
Today's topics:
Re: Echo '*' chars instead of what's typed (bad_knee)
Re: Echo '*' chars instead of what's typed (bad_knee)
Re: Echo '*' chars instead of what's typed (bad_knee)
Re: Echo '*' chars instead of what's typed (Greg Bacon)
Escaping characters / emacs font-lock-mode <torh+news@removethisbitbeforethedot.bogus.net>
Re: Escaping characters / emacs font-lock-mode <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: Escaping characters / emacs font-lock-mode <REMOVEsdnCAPS@comcast.net>
Re: Escaping characters / emacs font-lock-mode <torh+news@removethisbitbeforethedot.bogus.net>
Re: flock or IPC semaphore for atomic appends <asu1@c-o-r-n-e-l-l.edu>
Re: flock or IPC semaphore for atomic appends (Anno Siegel)
Re: flock or IPC semaphore for atomic appends <asu1@c-o-r-n-e-l-l.edu>
Re: Giving back (Sara)
Re: Giving back <usenet@morrow.me.uk>
Re: Giving back <flavell@ph.gla.ac.uk>
Re: Giving back Default@User011011101101.net
Re: Is a value a decimal number or not? <usenet@morrow.me.uk>
Re: last index of array reference <Peter.Dintelmann@dresdner-bank.no-spam.de>
Re: long running perl programs & memory untilization <stanb@panix.com>
Re: long running perl programs & memory untilization <usenet@morrow.me.uk>
Re: New to Wintel and 5.6.1.635 - control of end-of-lin <millsrg@earthlink.net>
Re: ParseRecur from Date::Manip <kha@rogers.com>
russian chars <bart-news@NOSPAMtvreclames.nl>
Re: russian chars <jbh@example.com>
Re: Stopping service on windows with signals Default@User011011101101.net
strange hash syntax (Torch)
Re: strange hash syntax <ak+usenet@freeshell.org>
Re: strange hash syntax <nobull@mail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Nov 2003 07:00:19 -0800
From: bl8n8r@yahoo.com (bad_knee)
Subject: Re: Echo '*' chars instead of what's typed
Message-Id: <e817ca4d.0311140700.59956edf@posting.google.com>
Chris Mattern <syscjm@gwu.edu> wrote in message news:<3FB3DCED.200@gwu.edu>...
> bad_knee wrote:
> > Hello,
> > I'm getting password input from the user in a perl script,
> > and was wondering if anyone knows how to echo splats at them
> > instead of not showing any chars at all? (eg: stty -echo)
> >
> Why tell potetial shoulder surfers how long the password is?
> That's valuable information.
>
> Chris Mattern
Your assuming too much.
------------------------------
Date: 14 Nov 2003 07:01:44 -0800
From: bl8n8r@yahoo.com (bad_knee)
Subject: Re: Echo '*' chars instead of what's typed
Message-Id: <e817ca4d.0311140701.745c0515@posting.google.com>
Ben Morrow <usenet@morrow.me.uk> wrote in message news:<bp0kt1$ah3$1@wisteria.csv.warwick.ac.uk>...
> Ben Morrow <usenet@morrow.me.uk> wrote:
> >
> > bl8n8r@yahoo.com (bad_knee) wrote:
> > > I'm getting password input from the user in a perl script,
> > > and was wondering if anyone knows how to echo splats at them
> > > instead of not showing any chars at all? (eg: stty -echo)
> >
> > perldoc -q password
>
> Sorry, the 'stty -echo' put me off, and I assumed you were asking how
> to not echo...
>
> I guess what you want to do is read one char at a time, either using
> read or by setting $/ = \1, and print the *s yourself. Note that you
> will probably have to put the terminal into cbreak mode and handle
> delete/backspace/etc yourself, which is probably why most Unix
> commands simply don't echo passwords... :) (There is also a slight
> security advantage: with *s, someone peering over your shoulder sees
> how long the password is.)
>
> Ben
Thanks for the input.
------------------------------
Date: 14 Nov 2003 07:14:48 -0800
From: bl8n8r@yahoo.com (bad_knee)
Subject: Re: Echo '*' chars instead of what's typed
Message-Id: <e817ca4d.0311140714.1e58df9a@posting.google.com>
gbacon@hiwaay.net (Greg Bacon) wrote in message news:<vr7n198ae5d0de@corp.supernews.com>...
> In article <e817ca4d.0311131043.1d2c0f43@posting.google.com>,
> bad_knee <bl8n8r@yahoo.com> wrote:
>
> : I'm getting password input from the user in a perl script,
> : and was wondering if anyone knows how to echo splats at them
> : instead of not showing any chars at all? (eg: stty -echo)
>
> Borrowing from tchrist's <6l8isu$cs7$2@csnews.cs.colorado.edu>:
>
> % cat try
> #! /usr/local/bin/perl
<snip>
my $template = "****";
my $str = "";
print substr($template, 1, int((rand(length($template)))));
> # print "*";
> STDOUT->flush;
>
> $passwd .= $ch;
> }
>
<snip>
> Hope this helps,
> Greg
Excellent. Thanks Greg, this is perfect.
I added a "random splat printer" for those that
asked how to do it.
Thanks for the help!
------------------------------
Date: Fri, 14 Nov 2003 16:19:02 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Echo '*' chars instead of what's typed
Message-Id: <vra03mp6r23vaa@corp.supernews.com>
In article <e817ca4d.0311140714.1e58df9a@posting.google.com>,
bad_knee <bl8n8r@yahoo.com> wrote:
: my $template = "****";
: my $str = "";
: print substr($template, 1, int((rand(length($template)))));
If you want Lisp, you know where to find it. :-) Perl's list operator
parsing can really reduce the fingernail clippings:
my $template = "****";
print substr $template, 1, rand length $template;
Assuming you want from one, two, three, or four splats, you should say
print substr $template, 0, rand(length $template) + 1;
: [...]
: Thanks for the help!
You're welcome.
Greg
--
Between a balanced republic and a democracy, the difference is like that
between order and chaos.
-- Chief Justice John Marshall
------------------------------
Date: Fri, 14 Nov 2003 14:39:49 +0000
From: Tor Houghton <torh+news@removethisbitbeforethedot.bogus.net>
Subject: Escaping characters / emacs font-lock-mode
Message-Id: <pan.2003.11.14.14.39.49.527244@removethisbitbeforethedot.bogus.net>
Am I right in that the following two are identical to the Perl interpreter?
$fsp=~s/([&; \'\"!|])/\\$1/g;
and
$fsp=~s/([&; '"!|])/\\$1/g;
?
(They are not identical for the Emacs "font-lock-mode" :)
Tor
------------------------------
Date: Fri, 14 Nov 2003 14:42:15 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: Escaping characters / emacs font-lock-mode
Message-Id: <Xns94339F7C3BB9Belhber1lidotechnet@62.89.127.66>
Tor Houghton <torh+news@removethisbitbeforethedot.bogus.net> wrote in
news:pan.2003.11.14.14.39.49.527244@removethisbitbeforethedot.bogus.net:
> Am I right in that the following two are identical to the Perl
> interpreter?
>
> $fsp=~s/([&; \'\"!|])/\\$1/g;
>
> and
>
> $fsp=~s/([&; '"!|])/\\$1/g;
Yes, you are right.
> (They are not identical for the Emacs "font-lock-mode" :)
That's not surprising. It's *only* Emacs, after all. ;-)
--
Cheers,
Bernard
------------------------------
Date: Fri, 14 Nov 2003 11:26:25 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Escaping characters / emacs font-lock-mode
Message-Id: <Xns94337E9B8C5E0sdn.comcast@216.196.97.136>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Tor Houghton <torh+news@removethisbitbeforethedot.bogus.net> wrote in
news:pan.2003.11.14.14.39.49.527244@removethisbitbeforethedot.bogus.net:
> Am I right in that the following two are identical to the Perl
> interpreter?
>
> $fsp=~s/([&; \'\"!|])/\\$1/g;
>
> and
>
> $fsp=~s/([&; '"!|])/\\$1/g;
>
> ?
>
> (They are not identical for the Emacs "font-lock-mode" :)
>
> Tor
Perhaps you need a better perl mode for your emacs installation. Cperl-
mode handles both cases equally well.
- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBP7UQUmPeouIeTNHoEQK9YgCfT+knaOIq36SMyBvQx8vBIW3j5DAAoNJ4
k5KzzzuWUbPD69dIT/OJYeoc
=Yfg0
-----END PGP SIGNATURE-----
------------------------------
Date: Fri, 14 Nov 2003 17:27:26 +0000
From: Tor Houghton <torh+news@removethisbitbeforethedot.bogus.net>
Subject: Re: Escaping characters / emacs font-lock-mode
Message-Id: <pan.2003.11.14.17.27.26.736600@removethisbitbeforethedot.bogus.net>
On Fri, 14 Nov 2003 14:42:15 +0000, Bernard El-Hagin wrote:
> Yes, you are right.
>
> [snip]
>
> That's not surprising. It's *only* Emacs, after all. ;-)
Thanks!
Tor
------------------------------
Date: 14 Nov 2003 15:22:13 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: flock or IPC semaphore for atomic appends
Message-Id: <Xns943369801133Dasu1cornelledu@132.236.56.8>
adwser@hotmail.com (jtd) wrote in
news:c57c103.0311140015.7052583b@posting.google.com:
> 2) Why is flock processor intensive? Does flock write something to
> disk when locking/unlocking?
From perldoc -f flock:
Two potentially non-obvious but traditional "flock" semantics
are that it waits indefinitely until the lock is granted, and
that its locks merely advisory.
I haven't looked at the source, but I think it is this waiting indefinitely
part (polling?) that's causing CPU usage to go up.
Sinan.
--
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov
------------------------------
Date: 14 Nov 2003 15:35:07 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: flock or IPC semaphore for atomic appends
Message-Id: <bp2snb$otk$1@mamenchi.zrz.TU-Berlin.DE>
A. Sinan Unur <asu1@c-o-r-n-e-l-l.edu> wrote in comp.lang.perl.misc:
> adwser@hotmail.com (jtd) wrote in
> news:c57c103.0311140015.7052583b@posting.google.com:
>
> > 2) Why is flock processor intensive? Does flock write something to
> > disk when locking/unlocking?
>
> From perldoc -f flock:
>
> Two potentially non-obvious but traditional "flock" semantics
> are that it waits indefinitely until the lock is granted, and
> that its locks merely advisory.
>
> I haven't looked at the source, but I think it is this waiting indefinitely
> part (polling?) that's causing CPU usage to go up.
No. Typically, file locking is event driven and no polling goes on.
Even when a lock is released implicitly (on close), the system knows
about it and can activate the new lock owner.
Anno
------------------------------
Date: 14 Nov 2003 16:19:33 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: flock or IPC semaphore for atomic appends
Message-Id: <Xns943373366FBD3asu1cornelledu@132.236.56.8>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in
news:bp2snb$otk$1@mamenchi.zrz.TU-Berlin.DE:
> A. Sinan Unur <asu1@c-o-r-n-e-l-l.edu> wrote in comp.lang.perl.misc:
>> adwser@hotmail.com (jtd) wrote in
>> news:c57c103.0311140015.7052583b@posting.google.com:
>>
>> > 2) Why is flock processor intensive? Does flock write something to
>> > disk when locking/unlocking?
...
>> I haven't looked at the source, but I think it is this waiting
>> indefinitely part (polling?) that's causing CPU usage to go up.
>
> No. Typically, file locking is event driven and no polling goes on.
> Even when a lock is released implicitly (on close), the system knows
> about it and can activate the new lock owner.
OK. Thanks for the correction.
Sinan.
------------------------------
Date: 14 Nov 2003 06:49:22 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: Giving back
Message-Id: <776e0325.0311140649.3978ff0b@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnbr7p2e.lqd.tadmc@magna.augustmail.com>...
> [Please limit your line lengths to the conventional 70-72 characters]
>
>
.
.
.
Really Tad,
[Please use a news reader from this century]..
This convention arose from punchcards which had, if I recall, 80
columns, 8 of which were special? I'd like to believe we've progressed
a bit since then.
I know traintracks use their width as a legacy handed down from Roman
Wagons (at least that's the conventional wisdom), but let's TRY to be
a little more progressive in our industry?
G
------------------------------
Date: Fri, 14 Nov 2003 17:51:30 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Giving back
Message-Id: <bp34n2$em2$2@wisteria.csv.warwick.ac.uk>
genericax@hotmail.com (Sara) wrote:
> tadmc@augustmail.com (Tad McClellan) wrote in message
> news:<slrnbr7p2e.lqd.tadmc@magna.augustmail.com>...
> > [Please limit your line lengths to the conventional 70-72 characters]
>
> Really Tad,
>
> [Please use a news reader from this century]..
Tad appears to use slrn, the latest release of which was made on
2003-08-25.
> This convention arose from punchcards which had, if I recall, 80
> columns, 8 of which were special? I'd like to believe we've progressed
> a bit since then.
The convention arises from those of us who use 80x25 consoles or
terminal windows, to allow for a few levels of '> > ' before lines
wrap.
*PLONK*
--
It will be seen... that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher arises among them who... convinc[es] them that their
...institutions are not based on... morality. [Samuel Butler] ben@morrow.me.uk
------------------------------
Date: Fri, 14 Nov 2003 18:48:56 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Giving back
Message-Id: <Pine.LNX.4.53.0311141825570.9701@ppepc56.ph.gla.ac.uk>
On Fri, 14 Nov 2003, Ben Morrow wrote:
> genericax@hotmail.com (Sara) wrote:
> > [Please use a news reader from this century]..
> The convention arises from those of us who use 80x25 consoles or
> terminal windows, to allow for a few levels of '> > ' before lines
> wrap.
It doesn't *matter* where it comes from, or how relevant it is to
newly-arrived wannabe-newsreaders: it's part of the accepted
netiquette (and of the draft USEFOR interworking specification, the
closest thing we currently have to a grandson-of-RFC1036): it's a
courtesy to other users to follow that netiquette.
If "Sara" wants to draft great-grandson-of-RFC1036, in which posting
to usenet is done according to some other set of interworking rules,
she'd have every right to do so, or at least to try to - on the
appropriate forum or group (if it's on usenet, it'll have "news." in
its top level hierarchy).
Meantime, it's appropriate to follow the accepted conventions; not to
unilaterally try to impose one's own. I'd recommend a somewhat-
conservative application of the USEFOR draft.
> *PLONK*
You too? I had already quietly done that on reading Sara's posting,
but since you thought it worth discussing, I decided to chip in
anyway. Ho hum.
all the best
NOTE: The extreme irritation caused to other readers by such
violations is not to be underestimated; however, enforcement of
such rules is more a matter of sensible design or of social
pressure (whose effectiveness should not be underestimated, even
though it cannot be prescribed).
Wise words, indeed.
------------------------------
Date: Fri, 14 Nov 2003 19:04:53 GMT
From: Default@User011011101101.net
Subject: Re: Giving back
Message-Id: <pH9tb.24$3o6.21@nwrdny01.gnilink.net>
That website was very helpfull indeed. Thanks for the excellent link.
And thanks for the suggestions, I really like the print tip alot.
------------------------------
Date: Fri, 14 Nov 2003 17:30:38 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Is a value a decimal number or not?
Message-Id: <bp33fu$dka$1@wisteria.csv.warwick.ac.uk>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
> In any case, the difference is in the internal representation of the
> numbers -- a subject I had hoped to keep out of this discussion of
> "decimals". Conceptually, there is no difference between 1 and 1.0.
There can be. There is no difference between 1-as-a-member-of-the-
set-of-reals and 1.0-as-a-member-of-the-set-of-reals. But 1-as-a-
member-of-the-set-of-integers is a quite different beast. For
instance, there is no such thing as the '1.0'th element of an array,
for that would imply that there was also a '1.1'th element, which is
clearly nonsense.
Sorry, as a mathematician I tend to be a little picky about such
things :).
Ben
--
I've seen things you people wouldn't believe: attack ships on fire off the
shoulder of Orion; I've watched C-beams glitter in the darkness near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die. |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-| ben@morrow.me.uk
------------------------------
Date: Fri, 14 Nov 2003 16:05:59 +0100
From: "Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.no-spam.de>
Subject: Re: last index of array reference
Message-Id: <bp2pjd$812@news-1.bank.dresdner.net>
Hi,
"Ryan Tate" <ryantate@ryantate.com> wrote in message
news:bovdd1$1l57$1@agate.berkeley.edu...
> If I have an array @array, I can get the last index with $#array.
>
> What is the equivalent way to get the last index of array reference
> $array?
perl -le '$x=[0,1,2,3]; print $#$x'
3
HTH,
Peter
------------------------------
Date: Fri, 14 Nov 2003 17:20:41 +0000 (UTC)
From: Stan Brown <stanb@panix.com>
Subject: Re: long running perl programs & memory untilization
Message-Id: <bp32t9$e0q$1@reader2.panix.com>
In <qu4tb.9323$cm6.63025@wagner.videotron.net> "Michele Ouellet" <ouellmi@videotron.ca> writes:
>> It does setup stuff (a lot of that), and then goes into a loop. In this
>> loop it does a system call to v4lctl to capture an image, then goes bacl
>to
>> sleep and waits. Curently it's one image every 10 seconds. Running since
>> moday, it had grown to a size of 1/2 a gig :-(
>>
>Hi Everyone,
>I am no Perl guru and not at all familiar with memory management under Linux
>or Unix. But I have experience with images.
>Have you considered that the problem may be memory fragmentation rather than
>a memory leak? Images typically require large CONTIGUOUS blocks of memory
>so, if the memory manager des not occasional compact free memory, that kind
>of situation can easily occur. I have seen this with older versions of
>Windows, such as Windows 95 and Windows 98.
I can't see how that would cause the size of teh perl script process to
grow.
Or perhaps I'm missing something here?
--
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
-- Benjamin Franklin
------------------------------
Date: Fri, 14 Nov 2003 17:43:40 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: long running perl programs & memory untilization
Message-Id: <bp348c$em2$1@wisteria.csv.warwick.ac.uk>
Stan Brown <stanb@panix.com> wrote:
> In <qu4tb.9323$cm6.63025@wagner.videotron.net> "Michele Ouellet"
> <ouellmi@videotron.ca> writes:
> >Have you considered that the problem may be memory fragmentation rather than
> >a memory leak? Images typically require large CONTIGUOUS blocks of memory
> >so, if the memory manager des not occasional compact free memory, that kind
> >of situation can easily occur. I have seen this with older versions of
> >Windows, such as Windows 95 and Windows 98.
>
> I can't see how that would cause the size of teh perl script process to
> grow.
>
> Or perhaps I'm missing something here?
If you have a braindead memory manager like Win9x's which never
compacts, then what can happen is this:
1. Perl requests a 10Mb (say) block for an image. The process's
address space is increased by 10Mb.
2. Perl frees the image. The 10Mb goes back into the process's free
space pool (note that it does not go back to the OS: in general,
a process's address space never shrinks).
3. Perl requests some more small allocations, which get made out of
the now free 10Mb block.
4. Perl requests the next 10Mb block. There is now no continuous block
of memory that large in the process's free space pool, as the one
we released last time now has some small allocations somewhere in
the middle. So we increase the process size by another 10Mb.
5. Goto 2.
This shouldn't happen under any decent OS, as the malloc
implementation should detect that fragmentation is occurring and
compact the free space pool.
--
don't get my sympathy hanging out the 15th floor. you've changed the locks 3
times, he still comes reeling though the door, and soon he'll get to you, teach
you how to get to purest hell. you do it to yourself and that's what really
hurts is you do it to yourself just you, you and noone else * ben@morrow.me.uk
------------------------------
Date: Fri, 14 Nov 2003 09:16:29 -0500
From: "R.G. Mills" <millsrg@earthlink.net>
Subject: Re: New to Wintel and 5.6.1.635 - control of end-of-line chars?
Message-Id: <d_6cnRgdV9lMfimiU-KYiA@giganews.com>
Thank you! RGM
"Sean Doherty" <spam@hexmad.com> wrote in message
news:4gn9rv81gfiiefdidrico5d8plark2sjn3@4ax.com...
> On Fri, 14 Nov 2003 08:42:18 -0500, "R.G. Mills"
> <millsrg@earthlink.net> wrote:
>
> >Under WinXP-Pro, "print" is helping me by outputting hex '0D0A' when I
try
> >to create a file containing only '0A' at that spot.
> >
> >How do I discontinue, or work around, this unwelcome assistance? Simple,
I
> >am sure, but it hasn't dawned on me yet.
> >
>
> binmode will do it.
>
> use strict;
>
> open OUF, ">out.txt";
> binmode(OUF);
>
> print OUF "Hello, World\n";
> close(OUF);
>
> etc.
>
> --
> s e a n @ h e x m a d . c o m | http://hexmad.com
------------------------------
Date: Fri, 14 Nov 2003 14:48:17 GMT
From: Kien Ha <kha@rogers.com>
Subject: Re: ParseRecur from Date::Manip
Message-Id: <RW5tb.1650$pF1.1276@news04.bloor.is.net.cable.rogers.com>
Arndt, Tobias wrote:
> Hi NG,
>
> trying to understand the ParseRecur function. Seems to be too complex
> for me. My goal is to get the first Monday from each month of the year
> 2003. My code:
>
> @date = ParseRecur("0:1*1:1:0:0:0","1/1/03","1/1/03","31/12/03");
you wouldn't get any output for @date because of ^^ ^^
@date = ParseRecur("0:1*1:1:0:0:0","1/1/03","1/1/03","12/31/03");
>
> print $date[3];
>
> # that should print out the First Monday in April 2003
>
> But I get 2003040700:00:00 !! That's the second Monday in this
> month.... :-(
No, that's 1st Monday of April, 2003.
print UnixDate( $date[3], "%a. %b %d, %Y\n");
=> Mon. Apr 07, 2003
> Maybe I didn't get the meaning of the three ($base etc..)variables
> from the example;
>
> # To find the 2nd tuesday of every month
> # @date = ParseRecur("0:1*2:2:0:0:0",$base,$start,$stop);
my $format = "%a. %b %d, %Y\n";
my ($base, $start, $stop ) = qw(1/1/03 1/1/03 12/31/03);
print map UnixDate($_, $format),
ParseRecur("0:1*2:2:0:0:0", $base, $start, $stop);
or verbally, you could do:
print map UnixDate($_, $format),
ParseRecur("2nd tuesday of every month in 2003");
--
------------------------------
Date: Fri, 14 Nov 2003 17:36:29 +0100
From: "Bart van den Burg" <bart-news@NOSPAMtvreclames.nl>
Subject: russian chars
Message-Id: <bp30a8$nhl$1@reader10.wxs.nl>
Hi
I'm starting to get some interest in east european languages (by now i know
a few words Latvian), and I'm trying to convert russian texts to fonetical
english. However, I think Perl is tripping over the charsets here, cause all
output i get from running the script below is
Use of uninitialized value in print at russisch.pl line 20.
25 times
Now i'm wondering: am i missing something extremely stupid here, or is this
really a problem? And if the latter is true: What can I do about it?
I save the text as UTF-8 in windows over samba to a linux computer... when I
do "cat russisch.pl" on an SSH shell with charset set to UTF-8, all is
correct
Thx
Bart
------------------------------------
#!/usr/bin/perl -w
use strict;
my $line = "????????????!";
my %write = (
"?" => "a",
"?" => "d",
"?" => "Z",
"?" => "r",
"?" => "v",
"?" => "s",
"?" => "t",
"?" => "oo",
"?" => "i",
"e" => "ye",
);
foreach (split(//, $line)) {
print $write{$_};
}
print "\n";
------------------------------
Date: Fri, 14 Nov 2003 17:50:22 +0100
From: James Henson <jbh@example.com>
Subject: Re: russian chars
Message-Id: <3fb507a0$0$58699$e4fe514c@news.xs4all.nl>
Hi Bart,
> Use of uninitialized value in print at russisch.pl line 20.
This probably means that you try to print a value that
isn't in your hash. Your example is somewhat distorted, I
assume the question marks should be utf-8 encoded
cyrillic chars.
> my $line = "????????????!";
This would be your input line, the line you are trying
to translate?
> my %write = (
> "?" => "a",
> "?" => "d",
> "?" => "Z",
> "?" => "r",
> "?" => "v",
> "?" => "s",
> "?" => "t",
> "?" => "oo",
> "?" => "i",
> "e" => "ye",
> );
Here you establish some mappings from the cyrillic
characters to phonetic spelling, I presume.
> foreach (split(//, $line)) {
> print $write{$_};
> }
I think this should work, but I guess your input line
contains something that is not in your map set.
Perhaps you can try to see if $write{$_} is defined,
and if it isn't just print $_ instead of the mapping?
Hope this helps,
James
------------------------------
Date: Fri, 14 Nov 2003 17:26:18 GMT
From: Default@User011011101101.net
Subject: Re: Stopping service on windows with signals
Message-Id: <_e8tb.33983$bQ3.21512@nwrdny03.gnilink.net>
Once you have succesfully installed your service:
<myservice> -install
There are certain things your script must define like the service name.
That is unless the program you are using to install / start the service
already takes care of that.
You can start it using:
net start <myservice>
And to stop it use:
net stop <myservice>
You may wish to pause the service:
net pause <myservice>
------------------------------
Date: 14 Nov 2003 07:59:54 -0800
From: rvw_torch@hotmail.com (Torch)
Subject: strange hash syntax
Message-Id: <d774347.0311140759.63aef382@posting.google.com>
I encountered a hash syntax I have never seen before, can somebody
help me understanding it.
$somehash{$somekey} = [ @somearray];
When I do print"$somehash{$somekey}" I get some strange number
ARRAY(0x20038114)as an output.
What does this mean????
I can;t find anything in my book and I do not nkow how to start
looking for it on the net...
Thx for any help!
Torch
------------------------------
Date: Fri, 14 Nov 2003 16:05:42 +0000 (UTC)
From: Andreas Kahari <ak+usenet@freeshell.org>
Subject: Re: strange hash syntax
Message-Id: <slrnbr9val.9i3.ak+usenet@mx.freeshell.org>
In article <d774347.0311140759.63aef382@posting.google.com>, Torch wrote:
> I encountered a hash syntax I have never seen before, can somebody
> help me understanding it.
>
> $somehash{$somekey} = [ @somearray];
This stores an array reference at the given location of the
hash. The %somehash now contains an array reference at the key
$somekey. You can index it like this:
# Third element of the stored array:
my $e = $somehash{$somekey}[2];
Or loop over it:
foreach my $e (@{ $somehash{$somekey} }) {
# Make use of array element $e here
}
Read the perldata manual.
--
Andreas Kähäri
------------------------------
Date: 14 Nov 2003 18:41:45 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: strange hash syntax
Message-Id: <u9d6bun66u.fsf@wcl-l.bham.ac.uk>
rvw_torch@hotmail.com (Torch) writes:
> $somehash{$somekey} = [ @somearray];
> What does this mean????
> I can;t find anything in my book
Others have addressed your immediate problem but if your book doesn't
explain [...] it sounds like it is probably a Perl4 book. There's a
lot of stuff in Perl5 that's not in Perl4 and there's a lot of stuff
that you had to do in Perl4 to work around its shortcommings that's
now considered very poor style in Perl5.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 5804
***************************************