return if $seen{$File::Find::dir}++; # skip if we've already seen it
print DEST "$File::Find::dir\n";
}
}
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.
On Mar 30, R. Joseph Newton said:
>Jeff 'japhy' Pinyan wrote:
>
>> The main problem is the PRECEDENCE. Your ? : line is run like so:
>>
>> ((++$count) ? ($count += $count--) : $count) += $count++;
>
>Have you tested this? I don't see the pr
he third line multiplies by 2 and adds 1. The net result
is adding one to $count, and then multiplying it by 4 and subtracting 1.
my $count = 0;
while (1) {
$count = ($count + 1) * 4 - 1;
print "$count\n";
exit if $count > 60_000;
}
--
Jeff "japhy" Pi
- it enforces safer coding practices
print "Enter your name: ";
chomp(my $name = ); # chomp removes the ending newline
my $old_name = $name;
$name =~ s/\W.*//;
$name = lc $name;
print "Old = $old_name\n";
print "New = $name\n";
--
Jeff "japh
On Feb 26, Boris Shor said:
>$e1 = ',';
>$aye =~ s/(?
>So this expression replaces spaces with newlines except when they are
>immediately preceded by a comma. But when I change
>
>$e1 = ',|R\.'
>
>(English: comma or "R."), I get "Variable length lookbehind not implemented
>in regex"
Because ',' a
On Feb 26, James Edward Gray II said:
>On Feb 26, 2004, at 3:20 PM, Jeff 'japhy' Pinyan wrote:
>
>> s/(?:(?
>??? I don't think that's gonna work. Let me check... No, doesn't
>seem to. There is always NOT going to be a proceeding comma OR NOT
>
ing =~ m{via:\s*(\d+\.\d+\.\d+\.\d+)}g) {
print "value = $1\n";
}
or use it in list context like this:
@values = $string =~ m{via:\s*(\d+\.\d+\.\d+\.\d+)}g;
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 htt
quot;scalar context\n" }
}
foo();
$x = foo();
@y = foo();
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for? why, yansliterate of course.
On Feb 10, Jeff 'japhy' Pinyan said:
>On Feb 10, James Edward Gray II said:
>
>>I said I cannot fix the grep() version. I'm just not that cool.
>
>I guess I'm cooler than you. ;)
>
> sub find {
>my $wanted = shift;
>my $found
ou want Carp::shortmess().
perldoc Carp
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for? why, yansliterate of course.
[ I'm looking for programm
On Feb 10, James Edward Gray II said:
>I said I cannot fix the grep() version. I'm just not that cool.
I guess I'm cooler than you. ;)
sub find {
my $wanted = shift;
my $found = 0;
{ grep $_ eq $wanted && ++$found && last, @_ }
return $found;
placements on the right.
But you might just want to do
$names[1] =~ s/\s+//g;
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for? why, yansliterate o
hank you for the feedback. I'll note that for a future edition of the book.
>That's also very similar to the way I have it in "perlboot", but nobody
>noted it there yet. :(
I would have, but I didn't think it necessary. When the question was
asked, I went to the perlbo
nimal::speak();
in your case becomes
Animal::speak($class);
except that it becomes that DYNAMICALLY.
>And when Perl does not find Animal::speak in Mouse, to:
Ah, here's the confusion. This isn't looking for a method named
'Animal::speak' in 'Mouse'; it's lo
't need to do anything special in Perl.
$string = "This is a
very long string
that spans
many lines";
Or you can use a 'here-doc'.
$string = << "END OF STRING";
this is a very
long string that
spans many lines
END OF STRING
--
Jeff "japhy" P
C G A C G _ _ _ _ _ _ _ bob
Ack. You're mixing the input with the output!
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for? why, yansliterate of
On Feb 4, John McKown said:
>On Wed, 4 Feb 2004, Jeff 'japhy' Pinyan wrote:
>
>> > foreach $i (@grok) {
>> > chomp($i);
>> >
>> >($item_num,$item_desc,$b1,$b2,$b3,$b4,$cc,$vn,$qoh,$qc,$qor,$bc,$sc,$yp)
>> >= split(/\|/,$i);
>>
s to affect the arrary in that
>it wont take any element assignments afterwards.
Then you're doing something wrong.
@array = ();
is the proper way to do it. Show us your code.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brothe
Oh good God. Do you know what that for loop is DOING?
for each element in @grok:
remove the newline
split it on pipes into some variables
print $inv, those variables with pipes in between, and add a newline
That is terribly insane.
> close FILE;
>}
Here's my rew
entered by the user
while () {
my ($name) = / >(.+)/;# get the line name
chomp(my $DNA = ); # get the next line (the DNA)
# add $size - length() dashes to the end of $DNA
$DNA .= "-" x ($size - length $DNA);
# print the DNA with spaces, then a tab, then th
On Feb 4, Rob Dixon said:
>That's an interesting point Jeff. You're right that it's
>
> Module->import()
>
>instead of
>
> Module::import()
>
>as 'import' will be inherited in the (common) case that
>Module ISA Exporter.
And also, '
;
sub import {
my $class = shift;
print "You gave me (@_)\n";
}
It's up to you to do something with @_.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
>Line3
>Sub1
>Subcode1
>Subcode2
>Endsub1
>Line4
>Line5
>Line6 calls sub1
>Line7
>Does the execution sequence go like this:
>
>Line1, line2, line3 line 4 line5, line6, sub1, subcode1, subcode2,
>endsub1 line7
Yes.
--
Jeff "japhy" Pinyan [EMAIL PROT
, you need to select() FOO and then set $| to 1.
my $old_fh = select FOO;
$| = 1; # now FOO is unbuffered
select $old_fh; # go back to whatever filehandle was previous selected
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734
: Don't use psuedohashes. Use an array with
>constant indexes. Its faster in the general case, its more guaranteed, and
>generally, it works.
>
>"The long summary is that I've done some work to get this working with
>modules that use psuedo hashes, but its still broken in th
nated
Those sound like Perl error messages. Show us your code, please.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for? why, yansliterate of course.
[ I
That's all you need. Save it as TAZ.pm if you want.
use TAZ;
tie @x, 'Tie::Array::Zero';
print $x[5]; # 0
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
print DAT "$line\n";
}
I might even do without $line:
for (@members) {
print DAT join(":", @$_), "\n";
}
Then, since it looks like that, I might use an inverted for loop:
print DAT join(":", @$_), "\n" for @members;
I request th
$arg)) {
# it's an open filehandle
}
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for? why, yansliterate of course.
[ I'm looking for progra
On Feb 1, Robin Sheat said:
>On Fri, Jan 30, 2004 at 10:33:27AM -0500, Jeff 'japhy' Pinyan wrote:
>> sub array_diff {
>> my ($first, $second) = @_;
>> my %diff = map { "@$_" => 1 } @$second;
>> return [ map !$diff{"@$_"
On Jan 31, Robert said:
>When they say "uncuddled else" are they meaning:
A cuddled else is:
if (...) {
...
} else {
...
}
Anything other than THAT is an uncuddled else.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
and then show us code you've tried with it. If you need help with what
you use it FOR, I can give you some advice and some pointers.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.o
it's efficient. It also prevents you from
doing the icky
for this (set a) {
for that (set b) {
compare this and that
}
}
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.
that's
what I'm about to show you:
my @sorted =
map $_->[0], # get back the original string
sort { $a->[6] <=> $b->[6] } # sort on 5th field (0 is the original)
map [ $_, split ],# array ref [string, fields]
@data;
Read it fr
dn't it
make more sense to pass the triplets as array references like so:
$network->pW(network => 1, [0,1,3], [0,2,2], [3,2,2]);
sub pW {
my $self = shift;
my ($net, $delta, $src, $dest, $layer);
# and then deal with @$src, @$dest, @$layer
}
That'd be my strategy.
ompare that with
($x, $y) = (5, 10);
while () {
print if $x .. $y; # prints all the lines
}
If you're using variables, you'll need to compare to $. explicitly.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #73
On Jan 29, Kevin Old said:
>On Thu, 2004-01-29 at 12:34, Jeff 'japhy' Pinyan wrote:
>> On Jan 29, Kevin Old said:
>>
>> >@one = qw(A B C D);
>> >@two = qw(E F G H);
>
>Well, no that wasn't what I was looking for, but it's a nice pi
;
If you need an explanation, feel free to ask.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for? why, yansliterate of course.
[ I'm looking for p
On Jan 29, Rob Dixon said:
>Jeff 'Japhy' Pinyan wrote:
>>
>> while () {
>> print "small " if 1 .. 10;
>> print "medium " if 6 .. 15;
>> print "big " if 11 .. 20;
>> print "\n";
>>
On Jan 28, John McKown said:
>On Wed, 28 Jan 2004, Jeff 'japhy' Pinyan wrote:
>
>> while () {
>> if (10 .. 20) {
>> print; # displays lines 10 through 20
>> }
>> }
>
>Wouldn't the following be slightly faster?
ou tried dividing by zero.\n" }
Basically, if we didn't use eval { } here, the program would die if the
user entered the number 0.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan
ot;line=$_" if $DEBUG > 0;
$found = 1, last if /$localpart:/;
}
Here, we exit the loop immediately when $found is set. This lets us use a
simply while clause () which assigns to $_ and tests for defined-ness
implicitly.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http:
7;t defined until Perl reaches them when
EXECUTING your program. And since the first thing Perl executes is the
'import' call, those arrays are defined too late to help.
One way to fix this is with a BEGIN block:
SomePackage->import('foo');
foo();
BEGIN {
package So
nd::name;
return 0 unless $pathname =~ /\.html$/;
# definition of the file path relative to the $gedicht_path
$relative_path = $pathname;
$relative_path =~ s#$gedicht_path/##;
# do stuff with hashes and arrays
};
find ($read_poem, $gedicht_path);
print
;
As for shrinking them
my @teilzeilen = split /\n/, ($eingabe =~ /Teilnehmer:\n\n(.+)/s)[0];
should work.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/
return ONE element. Getting all of them from @_ is the way to
do it.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for? why, yansliterate of course.
[ I&
your program, you can just write it as:
while () {
if (10 .. 20) {
print; # displays lines 10 through 20
}
}
For more on the subject, please read 'perldoc perlop' and look for
'Range Operators'.
--
Jeff "japhy" Pinyan [EMAIL PROTEC
lt;>) {
> last if $blank_lines xor /\S/;
> print if $output;
>}
> }
That might work in this specific case, but if you want to be able to
change the course of events like that without constant re-evaluation, I'd
suggest using code references:
my $code = \&first
either 'one or more non-<' or 'a
< that is not followed by /font' zero or more times".
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y///
On Jan 26, Paul Kraus said:
>foreach ( @{($hash{$key1}{$key2})[9..1]} )
It should be:
foreach ( @{ $hash{$key1}{$key2} }[1 .. 10] ) { ... }
based on your other email.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brothe
ram to use Gentoo Linux's Portage API which is
>written all in Python.
I believe you can do just that with Inline::Python, on CPAN.
http://search.cpan.org/author/NEILW/Inline-Python-0.20/Python.pod
It's from 2001, though... just so you know...
--
Jeff "japhy"
}x;
What this does on a string like "peach Georgia fruit" is this: the first
\S+\s+ matches "peach ". Then we capture "Georgia fruit" to $1. However,
the REST of the regex still has to match, but it can't, so the (?:\s+\S+)*
backtracks -- it gives up on
on't need to \ the . in either case, and you don't
need quotes around $ARGV[0] as the first argument to copy().
copy($ARGV[0] => "$ARGV[0].bak");
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.
rrorno, $fh) = @_;
print $fh "error $errorno $machine\n";
}
Where did you pick up your current idea about Perl's subroutines?
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http
# day of week (0-6)
my $day_name = $days[$dow]; # name of day of week
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for?
e string and such.
Then split on /\s*\|\s*/. That regex reads "zero or more whitespace, a |,
then zero or more whitespace".
@fields = split /\s*\|\s*/, $line;
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734
r ($_ =~ /two three/)) { ... }
You want either
if ($text =~ /one two/ or $text =~ /two three/) { ... }
or
if ($text =~ /one two|two three/) { ... }
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/
:
s/brian/jones/g;
s/on/off/g;
then we'd get "this is off joffes".
It's just something to keep in mind.
>I omitted the sort command since all patterns consist of a single (8-bit)
>character, so I guess your caveat is not applicable. My original message
>
regex:
$re = qr/($re)/;
The qr// operator (in perlop) gives you a compiled regex; it's good for
efficiency in certain situations (although this isn't really one of them).
$text =~ s/$re/$enctabelle{$1}/g;
That replaces all keys with their values.
--
Jeff "japhy" Pinyan
,0,12) = noon
Ta da. No big clunky modules, nothing to download from CPAN.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for? why, yansliterate of course
b "modules";
which does what you show above, plus a little more (see the lib.pm docs).
However, if @INC has been set up so that lib.pm can't be found... then
you're in a world of hurt.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~
On Dec 11, George Georgalis said:
>On Thu, Dec 11, 2003 at 09:05:20AM -0500, Jeff 'japhy' Pinyan wrote:
>>On Dec 10, George Georgalis said:
>>
>>>giving my perl a retry, I found some hints on a website to recursively
>>>replace text
>>>
>
all non-alphanumeric metacharacters don't
use backslashes. That means [...] for character classes, not \[...\], and
+ for " 1 or more", not \+, and so on.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://ww
uits; grep() does not. grep() will keep
going through the ENTIRE list, even if the FIRST element matches.
There's always the first() function from List::Util.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.
\.[0-9]+)?|$ph))\sin\s/in $1, /g;
>};
>This seems to work.
>Can someone test some more and give some bugs?
>Is there a generic module for doing operators?
I've never used Filter::Simple, so I don't know what $ph is representing,
so I'd like to know if your mod
c( ch, stdout );
>} else {
> putc( ' ', stdout );
>}
> }
perl -pi.bak -e 'tr/\040-\176\n/ /c' file
That'll change all characters that are NON between 0040 and 0176 and \n
into spaces.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED]
'T123 Here's one for the first thread',
'T237 Here's a different one', # <-- duplicate, not entered
);
for (@stuff) {
chomp;
my ($thread, $data) = split ' ', $_, 2;
push @{ $server{$thread} }, $data
unless grep $_ eq $data, @{ $se
On Nov 19, Rob said:
>This is what I finally came up with, but it too seems rather clunky.
>
>my $cnt = 0;
>$_ = $notes;
>$cnt = tr/\n//;
Yeah; why not:
my $count = ($notes =~ tr/\n//);
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy
module. It gives you specific profiling
information about your program. Read its docs to see how to use it.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for
# do stuff with $rec
}
$sth = $dbh->prepare($n_query);
$sth->execute($arg);
# if this is not the FIRST set of records
print qq{<<<}
if $prev != $offset;
# if there are more rows to show after these
print qq{>>>}
if $sth->rows;
I exp
note that
while () { ... }
is identical to
while (defined($_ = )) { ... }
which only reads ONE line at a time, whereas
for () { ... }
reads ALL the lines of the file at once, into a list.
A for loop is best used for iterating over a list of values, or, in the
C-style loop, running through
line.
{
local $| = 1;
# ...
}
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for? why, yansliterate of course.
[ I'm looking for programming work. If
at's the intended usage?
Probably for when you're using code that you haven't written that writes
to the default output filehandle.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://ww
with "select", except as
> permitted by POSIX, and even then only on POSIX
> systems. You have to use "sysread" instead.
That's out of context; that warning is for the multi-arg for of select().
--
Jeff "japhy" Pinyan [EMAIL
he message that print has an unopened filehandle ERRORLOG
>at line 7.
Right, because there is no ERRORLOG filehandle, only ER and EL.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.or
hat's because you're assuming the test is implicit; it's not:
unless grep $_ eq $another_name, @{$names{TEST}};
The grep() condition doesn't necessarily HAVE to be "the element equals
X", so you have to give it explicitly.
--
Jeff "japhy" Pinyan [E
change{$block} and exists $change{$block}{$attr}) {
s/\Q$attr\E.*/$attr $change{$block}{$attr}/;
}
# print the attribute
print;
}
}
Let me know if you understand it, or if you need more explanation.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http:/
On Nov 14, Douglas Houston said:
>On Fri, 14 Nov 2003, Jeff 'japhy' Pinyan wrote:
>
>> On Nov 14, Douglas Houston said:
>>
>> >I am trying to initialize a dynamically-named array, i.e. with the
>> >following test code (if I type "script.pl char&q
se warnings; # perl5.6+
my %data;
my $name = shift;
$data{$name} = [1,2,3];
# or
# @{ $data{$name} } = (1,2,3);
And your "while (<$ARGV[0]>)" is weird, and not working why you think it
works.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.c
$tempres[3];
You'd need $tempres[1] and $tempres[2], since arrays are 0-based, but
you'd also need ${ $tempres[1] } and ${ $tempres[2] }, since you're
returning references to those scalars. Using my return values, you'd do:
my ($start, $end, $listref) = $event->Even
ght of the last dot.
Here's one way:
($last_part) = $domain =~ /.*\.(.*\..*)/;
A slightly more verbose way is:
$last_part = substr(
$domain,
1 + rindex($domain, '.', rindex($domain, '.'))
);
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http:
eason is that Perl needs a true value to be returned from the file to
signal that it was compiled properly.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for?
ace what we've
matched (which isn't anything, we've only LOOKED) with a +, for all
occurrences".
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y///
ching either a digit, a -, or a + as the first
character in $diff. If you wanted to match a POSITIVE number, you'd be
better with /^+?\d/, but WHY are you using a regex for a MATH problem?
if ($diff > 0) { ... }
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.
uot;}."'");
You don't need quotes around keys to hashes, if they're simple strings
like the ones you've shown. Specifically, that last line could be:
$debug->cp3Debug("htmlHelper::new", "src='$sysData->{SRC}'");
Oh, and I don't kn
you have -2.9, you
get -2. If you were to write int() as a function of ceil() and/or
floor(), you'd have to say:
sub int { my $x = shift; $x > 0 ? floor($x) : ceil($x); }
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734
gt;{...}
# or do:
my %hash = %$href;
...
}
But I'd just use $href.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for? why, yanslitera
expecting tabs and spaces, but I'll
include carriage returns and formfeeds. I'd be tempted to change these
THREE regexes:
# pick ONE of the following TWO:
tr/\r\t\f / /s; # squashes consecutive [\r\t\f ]'s to a single space
# or
s/\s+/ /g;
# then do both of the f
27;},
>$user->{'phone'},
> $user->{'email'}) = @_;
> my $loginName = $user->{'loginName'};
> $self->{'users'}->{$loginName} = $user; <== This is line 47
And since $self is a string, and strict is on, $
On Nov 9, Dan Anderson said:
>Is it possible to cache Perl compilations on a web server so that it
>runs faster?
Yes, it's called mod_perl, and it's a module for the Apache web server.
See the Apache web site (http://www.apache.org/).
--
Jeff "japhy" Pinyan [
o => "bar"}, "bar";
>when the modules constructor was called by another module.
I have a feeling you've done
Module::new(args...)
instead of
Module->new(args...)
The first way is erroneous. The second way is correct.
--
Jeff "japhy" P
) {
Remember to reverse $1, though. You could also do
/.*VALUE=(\d+)/
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for? why, yansliterate of course.
On Nov 6, Dan Anderson said:
>
>> Dan> So: foo->bar qw(foo bar); is equivalent to foo->bar("foo","bar"); ?
>>
>> Only in recent Perls.
>
>Do you know exactly how recent? Are we talking 5 or better or 3 or
>better?
Without check pe
bject->method(...)
When you use qw(this that those), Perl changes that to
('this', 'that', 'those')
Perl splits the qw(...) on spaces, and returns the raw data,
single-quoted. This means no variables. You can't even escape a space:
qw( abc\ def )
bec
or method if
>called with a package name), and I use qw() it takes all words seperated
>by spaces, and passes them in as arguments.
>
>So: foo->bar qw(foo bar); is equivalent to foo->bar("foo","bar"); ?
>
>Thanks in advance,
>
>Dan
>
>
--
Jeff
I believe you are forming a non-standard HTTP request
>which is why CGI.pm doesn't have (at least I don' think) a way to pull
Incorrect. The 'url_param' does it. Look for "MIXING POST AND URL
PARAMETERS".
--
Jeff "japhy" Pinyan [EMAIL
D] : $values[0];
}
(request_method() eq 'GET' ? *GET : *POST) = \%hash;
}
>This seems kind of silly. Can anyone explain to me why this is?
Do you know how hard it is to do it RIGHT? Do you know how to parse file
uploads? And do all the other stuff correctly?
--
Jeff "japhy" Pi
rence to the foo function, but \&foo() is a reference
to the return value of the call to &foo().
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does y/// stand for?
ing
a checksum:
while (<>) {
$checksum += unpack("%32C*", $_);
}
$checksum %= 65535;
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
what does
re = ( some_genre => [ entry, entry, ... ] )
# each entry is a hash reference
push @{ $by_genre{$genre} }, {
genre => $genre,
artist => $artist,
album => $album,
disc => $disc,
file => $file,
fullpath => $full,
};
warn << "DEBUGGING" if
401 - 500 of 1591 matches
Mail list logo