fruitless, it did lead to:
my $qr = qr/^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
$qr =~ s/$qr//g;
print $qr, \n;
But that's a far cry from what I wanted to find.
Abigail
pgpMQ4E8ejcxP.pgp
Description: PGP signature
the only one.
I'd prefer to put -- there instead.
Abigail
pgpapui2lkHEz.pgp
Description: PGP signature
{$_ - [0]}
sort { ... }
map {[$_ = ...]} @unsorted;
Abigail
On Wed, Jul 16, 2003 at 01:37:27PM +0200, A. Pagaltzis wrote:
* Abigail [EMAIL PROTECTED] [2003-07-16 11:33]:
Yes. GRT usually have the form:
@sort = map { ... }
sort
map { ... } @unsorted;
with often pack/unpack in the map blocks, while an ST
On Thu, Jul 03, 2003 at 05:51:00AM +0100, Pense, Joachim wrote:
[ { my $staticvar; sub mysub {...} }versus sub mysub {static
$staticvar;} ]
Abigail and others point that the first version is more flexible than the
second one, which is true. Reason: the first construct allows subs
. And even in languages that do, it isn't used that
often. Not every Perl programmer nowadays came by the way of C. Not by
a long shot.
Abigail
with a 'static' declared variable inside a function.
Abigail
On Wed, Jul 02, 2003 at 10:33:01AM +0100, Pense, Joachim wrote:
Abigail wrote
On Wed, Jul 02, 2003 at 07:58:03AM +0100, Pense, Joachim wrote:
that is often recommended in the Perl community. I think it
is easy to see
which version looks elegant and which one kludgy
On Wed, Jul 02, 2003 at 11:09:54AM +0100, Pense, Joachim wrote:
Abigail wrote
| sub x {
| static $vbl ;
| ...
|
| {
| my $vbl;
| sub x {
| ...
| }
| }
IMO, not doubt the latter looks far
On Wed, Jul 02, 2003 at 01:02:12PM +0100, Pense, Joachim wrote:
-Original Message-
From: Abigail [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 02, 2003 1:51 PM
To: Pense, Joachim
Cc: [EMAIL PROTECTED]
Subject: Re: my if?
On Wed, Jul 02, 2003 at 11:09:54AM +0100
123456
123456
123456
reverse 0, 1, 2, 3, 4, 5 Modification of a read-only value attempted
0, 1, 2, 3, 4, 5 Modification of a read-only value attempted
Abigail
.
(?=.*[-_]) # Contains a dash or an underscore.
(?!.{15}) # Doesn't contain 15 characters.
/xs;
It's easy to add more requirements.
Abigail
[aA]{2})(\W|$)/
I think it's worth mentioning that, right or wrong, postcodes are often
written without the space in the middle. Abigail didn't mention whether
he wanted to just match the canonical form, or match any common form.
I'll probably make it so that people can do things like
that [2 1 3 4 5] has
an odd parity, while the parity of [1 2 3 4 5] is even. But if no operation
can change the parity, there's no way of going from [2 1 3 4 5] to
[1 2 3 4 5].
Abigail
you could it in a single regex.
I answered the question - your remarks don't have much to do with it.
Abigail
purposes, might I
suggest:
$sql =~ /(\s*)/ and $sql =~ s/^$1//mg;
The question was how to do it in one regex; the original poster
already knew how to do it with two regexes.
Abigail
.
On second thought, /^(\s*|)/ to avoid warnings.
What kind of warning? Do you know of a string where /^(\s*)/ doesn't
match? Perhaps a string without a beginning? Or that has -1 space at
the beginning?
Abigail
'
Abigail
but doing something else,
or inefficient. But I don't think any of them applies to this
particular example.
Bart, can you explain why this is bad style? Or is it just your
personal preference?
Abigail
and 2079 solutions use only additions and concatination.
Abigail
should read the data row by row, finding each CREATE TABLE statement,
and displaying the next ~50 lines INCLUDING this line - do this recursively
until end of file is reached.
grep -A 50 'CREATE TABLE' file.sql
Abigail
be too embarrassed to give a talk.
3) I gave obfuscation talks (about Japhs) on YAPC::NA::2000 and
YAPC::NA::2001.
Abigail
1. Perhaps not- I like the style and I appreciate you passing it on to me.
I'm always looking for more perlish idioms. Yours will take some study
however. I
] .. $#{$_ [1]}, 0 .. $_ [0] - 1]]
}
Abigail
Rotate 15: A B C D E A
Abigail
E
Rotate 6: B C D E A
Rotate 7: C D E A B
Rotate 8: D E A B C
Rotate 9: E A B C D
Rotate 10: A B C D E
Rotate 11: B C D E A
Rotate 12: C D E A B
Rotate 13: D E A B C
Rotate 14: E A B C D
Rotate 15: A B C D E
Abigail
1, 2
foo, 1, bar, 2
But '$href - %' and also '$href - %' are syntax errors. You
can put a variable on the right side of an arrow, but not a
literal string.
Abigail
if 'END' eq substr $vFlag, 1, 3;
next if '[' eq substr $_, 0, 1;
{
local $ = |;
no strict 'refs';
(ucfirst lc $1) - () if $vFlag =~ /^.(tags)/;
}
Abigail
ago, the, to quote Larry,
It's not just C. It's also any language than I've programmed in.
It's also a rather significant break from 14 years of perl.
Abigail
a shortcut:
my %scut = %some_nested_hash{very_long_descriptive_key}{another_key}{one};
if %scut.{last_key} { # Perl 6 hashref syntax.
# do stuff
}
Having to *add* code isn't actually making a shortcut, is it? ;-)
Abigail
On Fri, Apr 12, 2002 at 02:14:36PM -0700, Erik Steven Harrison wrote:
--
On Fri, 12 Apr 2002 18:27:11
abigail wrote:
On Fri, Apr 12, 2002 at 04:42:07PM +0100, Piers Cawley wrote:
[EMAIL PROTECTED] writes:
Why isn't
if %foo {key} {print Hello 1}
equivalent
5.8 certainly isn't
marking 'for' as deprecated, so it won't disappear any sooner than 5.12.
BTW, if Larry is going to rename 'for' to 'loop', then he plans to keep
it around. Doesn't sound deprecated at all to me.
Abigail
over an array.
Abigail
edition.
Section 3.4.2, Algorithm P, pp 145. Reading: Addison-Wesley, 1997.
ISBN: 0-201-89684-2.
=item [4]
R. Salfi: ICOMPSTAT 1974. Vienna: 1974, pp 28 - 35.
=back
Abigail
then that will be treated as the 'then' block. If it's the
end of file, or a nonblock, then it'll be a syntax error.
Did the code show anything following it? No? Well, then assume
it isn't there. ;-)
Next time I'll show this to someone, I'll add a semicolon.
Abigail
.
Luckely, there's a 1-character length operator that is documented
to first evaluate the left operand, then the right: ,
($a^$b)=~/\0*/,$+[0]
If you actually want to assign the result, you'd have to write it as:
($a^$b)=~/\0*/,$x=$+[0]
Abigail
.
$VAL = ($a^$b)=~/\0*/*$+[0];
$VAL = ($a^$b)=~/\0*/,$+[0];
Well, it can be dropped in, you just have to know how to drop it! ;-)
($a^$b)=~/\0*/,$VAL = $+[0];
Abigail
P, pp 145. Reading:
Addison-Wesley, 1997. ISBN: 0-201-89684-2.
[2] R. A. Fisher and F. Yates: IStatistical Tables. London, 1938.
Example 12.
Abigail
.
No references, no return in a wierd place, no check for special cases.
(Yes, I realize that it swaps element 0 with itself at the end - a fair
price for the simplicity)
Abigail
problems.
Abigail
wasn't
following so I killed the thread and I don't even know [or care] how much
longer it went on..].
Now, if I could place filters at my ISP, I'm all for it. But since that's
out of the question, I don't go for the tune out reasoning.
Abigail
,
for everything.
Abigail
because a bunch of people in Alaska do that in winter.
Abigail
always said, and I keep on saying so, that Perl is not suited for
most people calling themselves programmer.
Having said that, I really enjoyed Abigail's presentation a few years
back at YAPC.
Thanks.
Abigail
.
The relevant part of said program follows.
Abigail
my $ENVIRONMENT = /some/file/somewhere;
if (@ARGV $ARGV [0] eq '--sourced_environment') {
shift;
}
else {
if (-f $ENVIRONMENT) {
#
# Now we perform a double exec. The first exec gives us a shell,
# allowing us
of the perl FAQ addressing this question did you fail to understand?
Abigail
restriction.
Abigail
in highest) {
stick in highest, removing lowest in highest;
}
}
return sort highest
The Big Oh of that is n.
No, it's not. It's O (n log X).
Abigail
the desired
ratio.
Or, by using comments and strings, ratios as close to 1 as wanted can
be archieved.
Abigail
${\context}\n;
__END__
LIST
This makes the ${\(EXPR)} not very useful; one could as well use
@{[EXPR]} - which not only saves a keystroke, but is more symmetric.
Abigail
}
(as in your example) is still shorter than
@{[foo]}
(agreed however that the latter looks nicer).
Yeah, but \ has quite a high priority. Higher than most binary operators.
Most expressions you'd need to parenthesize.
Abigail
their
claim with any evidence.
Cargo-cult programming is bad, but making cargo-cult claims is as bad.
Abigail
)
Here's a start. It finds URIs for http, ftp, news, nttp, telnet,
gopher, wais, mailto, file, prospero, ldap (sort of), z39_50,
cid, mid, vemmi, imap and nfs. Not what you'd call complete.
You'd have to remove the newlines. ;-)
Abigail
(?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z
^=~, the ^ prefix can be used for most, if not all,
operators.
@c = @a ^+ @b;
is far clearer than the map equivalent.
Abigail
On Sun, Jan 20, 2002 at 11:31:25AM -0600, Matthew Wickline wrote:
(well, it /is/ winking at me!)
why not call it a wink? ... or maybe a flirt?
I was thinking of something like winking Siamese (^=^ being a
Siamese cat).
Abigail
].*$)|
(?:^([\x00-\xfd].*)\xfe.*\508$)|
(?:^(.*)\xff.*\509[\x00-\xfe].*$)|
(?:^([\x00-\xfe].*)\xff.*\510$)/sx
We could factor out the ^ and $ and save a few bytes in the resulting
regex, but that's left as an exercise to the reader.
Abigail
Abigail
in both %b and %c (which would mean $a {$k} equals $c {$k}), we're
adding the value of $b {$k}. This results in $a {$k} == $b {$k} + $c {$k}.
For all keys that are in either %b or %c, but not both, %a will get the
key with the corresponding value.
Abigail
will be filled in by Perl, with an appropriate
value, typically undef (which would become 0 in numerical context).
Abigail
+= 2;
}
my $regex = join |\n = map {(?:$_)} @strings;
$regex = ^(?:$regex)\$;
print /$regex/sx\n;
__END__
Abigail
. While abc1234 is a correct
password, if doesn't match y/A-Za-z// y/0-9//.
Abigail
be shortened to 'y===c' (which was dubbed
Abigail's length horror by Larry Rosler).
So, if you want to combine golf with obscurity, write it as:
50yc
Abigail
between 0 and the empty string.
do {no warnings; not local $_ = $flag and length};
Abigail
};print'
Abigail
.
Abigail
function. (A function cannot
be both little-oh and little-omega of another function - hence there's
no little-theta.) There's also Big-Lambda and little-lambda.
Abigail
and J::j
perl -MJ
for suitable values of J.pm and J::import
perl
for suitable values of PERL5OPT
p
for suitable values of p
And nothing at all for suitable values of /var/spool/cron/crontabs/root.
Abigail
On Wed, Aug 22, 2001 at 06:46:43PM -0400, Keith C. Ivey wrote:
Abigail [EMAIL PROTECTED] wrote:
Being the one who has given several talks about Japhs, I've
decreed that a Japh uses the following rules:
- It prints Just another Perl Hacker with some reasonable
captalization
years)
If clashes with iteration is the worst thing that can happen if you share
hashes between different modules by different authors, I will change my
mind about the usefulness of lexical variables.
Abigail
..9;keys%$x910==ycprint' words
Abigail
On Wed, Aug 01, 2001 at 12:39:50AM +0200, Bart Lateur wrote:
On Wed, 1 Aug 2001 00:24:50 +0200, Abigail wrote:
There's more than one block in do {{EXPR; last}}.
Argh!
Pretty obfuscated, that is.
Straigth from perlsyn.
Abigail
On Wed, Aug 01, 2001 at 02:44:12AM +0200, Marc A. Lehmann wrote:
On Wed, Aug 01, 2001 at 02:13:53AM +0200, Abigail [EMAIL PROTECTED] wrote:
Minor and irrelevant details. The principle, a nest of a bare block
and a compound block to be able to use loop control is straight from
perlsyn.pod
that.
Abigail
(be them increasing or decreasing) are determined. If you
would then swap pairs, Perl will think the entire array is already
monotonic - and you will have a sort that runs in linear time!
Abigail
strings in O (N) time)
Abigail
;
$count ++;
print $result ? ok : not ok , $count, $trailer, \n;
}
ok (...);
FOO: {
local $trailer = # TODO;
ok (...);
}
ok (...);
Abigail
TODO feature, he must obey the rules. schwern didn't
agree. later this week i will clobber him with a blunt contract and we
shall see if he won't change his mind. :)
Here. All the magic in a package, with the user only having to make
a TODO: {} block.
package Abigail;
use strict
76 matches
Mail list logo