and shortest.
--
John Douglas Porter
__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
A. Pagaltzis [EMAIL PROTECTED] wrote:
* John Douglas Porter [EMAIL PROTECTED] [2003-02-07 14:15]:
@lines = split /\n/, $x, -1; pop @lines;
$/ can be different from \n though.
Yes, but his example data was text in a here document.
But you can always do
split m,$/, $x, -1
A. Pagaltzis [EMAIL PROTECTED] wrote:
John Douglas Porter [EMAIL PROTECTED]:
Yes, but his example data was text in a here document.
Then add a note about the caveat.
Sorry, I thought (and still do) that the OP's caveat was
understood to still be in effect.
join \n, @lines, $tail
@lines = length($x) ? $x=~/^(.*)$/mg : ();
--
John Douglas Porter
__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
, arrays don't sort meaningfully with Perl's
default sort. However, the Python default sort knows how
to compare arrays. So to a Python programmer, the ST can
be achieved using the default sort.
But that still doesn't make it a GRT.
--
John Douglas Porter
__
Do you
my %data; @[EMAIL PROTECTED] = ();
/$regex/ $data{$ARGV}{$1}++ while ;
print
map { my $this = $_;
map { my $that = $_;
map { In $this but not $that $_\n }
grep { not exists $data{$that}{$_} } keys %{$data{$this}} }
grep { not $_ eq $this } keys %data } keys %data;
--
John Douglas Porter
Maybe it would be easier to invert the levels of the hash:
my $re = shift;
my @f = @ARGV;
my %h;
/$re/ and $h{$1}{$ARGV}++ while ;
for my $s ( keys %h ) {
print '$s' in (@{[ keys %{$h{$s}} ]}),,
not (@{[ grep { not exists $h{$s}{$_} } @f ]})\n;
}
--
John Douglas Porter
Honza Pazdziora [EMAIL PROTECTED] wrote:
But 8.2 is not TRUE value. If returns_a_true_value is supposed to
return a true true value, it should end with
return TRUE;
shouldn't it?
Well, no. If it is supposed to return a true value, then it
could return any true value, and 8.2 falls
Steven W. Orr [EMAIL PROTECTED] wrote:
Umm, I think what you were trying for was . . .
Thank you, but I wrote exactly what I meant to.
--
John D. Porter
__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
...
printf $fractional_cents ? '%7.3f' : '%7.sf', $amt;
irrespective of the value of $amt. Why is this not right?
--
John Douglas Porter
__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com
that simple?
$s = sprintf %7.3f, $amt;
$s =~ s/(\.\d\d)0/$1/;
No? (Sorry I'm la[tm]e, if this has already been covered.)
--
John Douglas Porter
__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http
I think we'd like to avoid solutions that involve loading
entire file into an array, agreed?
Here's how I'd do it:
sed -n '5,$p'
--
John Douglas Porter
Josh Goldberg [EMAIL PROTECTED] wrote:
Here's a little oneliner to skip the first 5 lines of the file 'foo':
perl -i5 -e '@_=STDIN
as Perl Diety (sic) or Mister Perl doesn't
understand how parentheses work.
--
John Douglas Porter
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
$_ ? \$$_ : \$_ for values %copy;
@{$self-{templates}}{ keys %copy } = values %copy;
Three statements vs 1, and a temporary variable...
I'm not sure that's better either. Maybe clearer.
--
John Douglas Porter
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best
.
If you really want to test the ref type, do so
robustly using the methods in Scalar::Util.
--
John Douglas Porter
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
problem with the technique; see
http://perlmonks.org/?node_id=561931
--
John Douglas Porter
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
operations (including the *missing*
operations, which have to be kludged in Perl), the set-
related CPAN modules, and how all these things can be used.
JMHO. Sorry if someone already made this point and I missed
it.
--
John Douglas Porter
Uri wrote:
i still think isa is a (sic) concept that is important enough to
cover on its own. sure it is a set but a very specific type
with its own name. the names of these concepts are important
(almost like design patterns which i despise :).
If names are that important to you, then you
Maybe this is too obvious...
and I know it's not regex...
tr/A-Z/222333444555666888/;
--
jdporter
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
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
So is that the Perl 6 smart match operator? or something else?
In any case... How does it work here? It looks like it's functionally
equivalent to scalar()... but why?
--
jdporter
--- On Wed, 3/14/12, Philippe Bruhat (BooK) philippe.bru...@free.fr wrote:
From: Philippe Bruhat (BooK)
Philippe Bruhat (BooK) philippe.bru...@free.fr wrote:
Andrew Savige wrote:
I wonder if --$| and $|--, ... described
by japhy as the magical flip flop variable
qualifies as a secret operator?
My rule has been to keep
only the well-known operators, or the ones that had a
nickname
It's not clear whether you want every other element, beginning with the first
or every numeric element with the property 'odd'. Your example doesn't clear
that up at all. :-)
If it's the latter you want:
map { $_ 1 ? $_ : () } @l;
--- On Wed, 5/16/12, damien krotkine dkrotk...@gmail.com
And of course, use grep, as others have said.
@list[ grep !$_%2, 0..$#list ];
that gets you every other element, beginning with the first.
--- On Wed, 5/16/12, John Douglas Porter johndpor...@yahoo.com wrote:
From: John Douglas Porter johndpor...@yahoo.com
Subject: Re: seeking golfing
From: Aristotle Pagaltzis pagalt...@gmx.de
Subject: Re: seeking golfing advice
To: fwp@perl.org
Date: Friday, May 18, 2012, 5:29 AM
* Steve Fink sph...@gmail.com
[2012-05-18 10:25]:
On Thu, May 17, 2012 at 3:14 AM, Aristotle Pagaltzis
pagalt...@gmx.de
wrote:
* Mike Erickson
26 matches
Mail list logo