* Ronald J Kimball rjk-perl-...@tamias.net [2011-11-16 21:50]:
It is greedy, but the important thing to remember is that the regular
expression engine will find the longest *leftmost* match.
To put that a third way: the engine will match at the first possible
location, and will make the match
Greetings Sandro all,
From the keyboard of Sandro CAZZANIGA [16.11.11,14:26]:
hi!
Just a little JAPH for convert decimal to binary Feel free to comment
it ;)
golfed down a bit, just for fun...
#!/usr/bin/perl -l
@ARGV or die No args;
print$_: ,($_=unpackB*,packN,$_)=~s/0+//?$_:$_
What's the point? Seems to me the only purpose of this code beyond the obvious
unpack(B*,pack(N, $arg))
line is to reformat the result into an odd, probably application-dependent
format.
--- On Wed, 11/16/11, Sandro CAZZANIGA cazzaniga.san...@gmail.com wrote:
From: Sandro CAZZANIGA
On 2011-11-16 09:57 -0500, Ronald J Kimball wrote:
That should be s/0*//, otherwise you'll get the wrong result for numbers
above 2147483647.
That should be s/^0*//, otherwise you'll get the wrong result for
numbers above 2147483647.
Also:
printf$_:%b\n,$_ for@ARGV
--
On Wed, Nov 16, 2011 at 04:14:57PM +0100, Olof Johansson wrote:
On 2011-11-16 09:57 -0500, Ronald J Kimball wrote:
That should be s/0*//, otherwise you'll get the wrong result for numbers
above 2147483647.
That should be s/^0*//, otherwise you'll get the wrong result for
numbers above
Hasn't anyone noticed that a decimal to binary or whatever conversion
isn't a JAPH by definition, alone because it does anything other than
output the JAPH? With a looser definition it must at least output Just
another Perl hacker, perhaps on stderr
Daniel Cutter
@_=($_=aaceeehhjklnoprrrsttu,
On 2011-11-16 11:57 -0500, Ronald J Kimball wrote:
No, you are wrong. s/0*// is sufficient, because /0*/ will always match at
the start of the string anyway.
You're clearly an expert. I yield. Can you open a bug report with perl
and getting this fixed?
--
On Wed, Nov 16, 2011 at 07:49:14PM +0100, Olof Johansson wrote:
On 2011-11-16 11:57 -0500, Ronald J Kimball wrote:
No, you are wrong. s/0*// is sufficient, because /0*/ will always match at
the start of the string anyway.
You're clearly an expert. I yield. Can you open a bug report with
From the keyboard of Ronald J Kimball [16.11.11,14:14]:
On Wed, Nov 16, 2011 at 07:49:14PM +0100, Olof Johansson wrote:
On 2011-11-16 11:57 -0500, Ronald J Kimball wrote:
No, you are wrong. s/0*// is sufficient, because /0*/ will always match at
the start of the string anyway.
rye
On 2011-11-16 14:14 -0500, Ronald J Kimball wrote:
It's working as expected for me, so I'm not sure what needs to be fixed.
Hum, now I'm ashamed. Sorry. But why is that not greedy? (I got other
results earlier, but I can't reproduce now so I have probably made an
error in my earlier attempts.)
Olof Johansson o...@ethup.se wrote:
But why is that not greedy?
Remember, the *first* match wins, even if it's shorter
than a possible later match.
ISTR that some have argued that's a bug.
Well, too bad. It's too late. :-)
--
john many jars porter
On Wed, Nov 16, 2011 at 09:34:58PM +0100, Olof Johansson wrote:
On 2011-11-16 14:14 -0500, Ronald J Kimball wrote:
It's working as expected for me, so I'm not sure what needs to be fixed.
Hum, now I'm ashamed. Sorry. But why is that not greedy? (I got other
results earlier, but I can't
12 matches
Mail list logo