variable for a couple decades at
least.
--
Jeff japhy Pinyan% How can we ever be the sold short or
RPI Acacia Brother #734% the cheated, we who for every service
http://www.perlmonks.org/ % have long ago been overpaid?
http://princeton.pm.org/ %-- Meister Eckhart
function, localtime
You really just want to do this:
my @days = qw( Sun Mon Tue Wed Thu Fri Sat Sun );
my $d = (localtime)[3];
print Today is $days[$d].\n;
See 'perldoc -f localtime'.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734
=~ /([\w\s]+):([\w\s]+)/g) {
my ($k, $v) = ($1, $2);
# ...
}
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org
On Sep 3, [EMAIL PROTECTED] said:
foreach my $i (0 ..$#lookup_datatype){
my $plus;
($plus) = /([0-9]+)/ , $lookup_datatype[$i];
I think you want
($plus) = $lookup_datatype[$i] =~ /([0-9]+)/;
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734
$data-{Field4}, not $data{Field4}.
{
print match = , $data-{$_}-[0], \n;
}
}
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http
;
}
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED
On Aug 29, Anil Kumar, Malyala said:
How to get all the first days of a week in a month.
How do you define the first day of a week? Do you mean I want to know
the dates of every Sunday in a month? Please be specific.
--
Jeff japhy Pinyan % How can we ever be the sold short
;
Unless you are writing the EXACT SAME NUMBER OF BYTES to the file, you are
going to either over-write or under-write content.
You're probably better off using a temporary file, or Perl's in-place
editing.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother
On Aug 29, Andrew Stewart said:
...which version will Perl end up ultimately loading at 'use module'?
It goes in order of @INC (and its subdirectories), and uses the first one
it finds.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734
the shell to do them all.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail
with questions and plz this is urgent emails, and
I'm going to delete every single one.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http
.
To store a regex (not a pattern match, mind you, but a regex) in a
variable, use the qr// constructor:
my $exp_test = qr/^\d+$/;
Then use it like so:
if ($string =~ $exp_test) { ... }
You can also embed that inside another regex:
if ($string =~ /$exp_test/m) { ... }
--
Jeff japhy
a number up to the next integer value (unless
the value is an integer), use ceil() from the POSIX module. ceil(1.1) ==
2, ceil(1.9) == 2, ceil(2) == 2. To always round down, use floor() from
POSIX.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734
numbers: -14 to round up to the next
multiple of 5 is -14 + (14 % 5) which is -14 + 4 = -10.
To round down, it's simply:
$x - ($x % $t)
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http
] and there's no
point in match ZERO digits at the end of the string.
But I would just do:
$str =~ s/(?=[a-zA-Z])\d+$//;
which removes digits at the end of a string IF AND ONLY IF they are
preceded by a letter.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia
$array[2];# '3'
print $array-[2]; # nothing, $array doesn't exist!
print $ref[2]; # nothing, @ref doesn't exist!
print $ref-[2];# '3'
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http
processes, through the %ENV hash. But you cannot change
your parent's environment.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http
roll your own with substr() and what-not, or you can use the
unpack() function to do it for you:
my @chunks = unpack (A4/A)*, $buffer;
The A4/A means read four characters and get that many characters; the
(...)* around that means do this repeatedly.
--
Jeff japhy Pinyan % How can
;
The third argument of -1 means include all empty trailing fields, so
that if your data is abc\tdef\tghi\t\t\t, you'll get (abc, def,
ghi, , , ) back.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http
], that means it's greater
than 500 (in your sample case), thus it gets the same discount as 500
items. Since $discount[500] is the last element in @discount, it's the
same as $discount[-1].
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734
On Aug 15, Scott R. Godin said:
Jeff 'japhy' Pinyan wrote:
Oh, Jolly Good! though I'm somewhat concerned with how much memory that would
take up. Ultimately this would be running as a cgi processing a web-form
submission.
Unless you're dealing with thousands of elements in your array, I
variable to the end, then an e-mail is not
sent, I have no clue, why is this way.
We can't tell, because you haven't shown us the code that DOES stuff with
those arguments.
Is there any specific syntax in passing argument values?
You're doing it fine.
--
Jeff japhy Pinyan % How can we
is to determine the reason and sample data that
demonstrates the problem.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org
. Because of this, your
print() statements are never even executed. In fact, only the first one
ends up being compiled -- Perl never REACHES the second one at all, since
it has tried to include the NotARealPackage module.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia
OR a filehandle as its
argument.
perldoc -f truncate
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
in $_ which matches that pattern. See 'perldoc perlretut' for
more information on regexes.
The code was probably something like
for (@dna) {
if (/$base2/) {
...
}
}
which iterates over the values in @dna and does something for each value
that contains $base2.
--
Jeff japhy
*.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED
and $seed are unnecessary.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e
if a string is less than another.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
}) {
$code-(@arguments);
}
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e
to do calculations for THEM.
It's not a very difficult process at all, and a good exercise, I think.
I hope this module helps you complete your task.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http
have to use
$KPIDB::config{...} instead of $config{...}.
main;
Perl is not C. Please do not define a main() function and then call it as
the body of your program. This is unnecessary.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734
OUTPUT;
move( $text_file, $text_file.bak );
move( $out_file, $text_file );
}
}
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http
calculated before you can sort them.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe
important thing is the speed and using as less memory as possible.
Then it's certainly
do_this(\%hash);
sub do_this {
my $href = $_[0];
print $href-{key}; # etc.
}
Pass a reference, and don't dereference it!
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia
apropos example:
if ($data =~ /^([EMAIL PROTECTED])$/) {
$data = $1; # $data now untainted
} else {
die Bad data in '$data'; # log this somewhere
}
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated
On Aug 2, Tom Allison said:
What do they mean by
Uncuddled elses. in perldoc perlstyle?
A cuddled else is this kind:
if (...) {
...
} else {
...
}
whereas an uncuddled else is:
if (...) {
...
}
else {
...
}
--
Jeff japhy Pinyan % How can we ever
japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED
doesn't allow
placeholders in LIMIT. All you need to do is make sure the values are
non-negative integers, and you can write
$sth = $dbh-prepare(select ... limit $start, $length);
If you need to escape things, you $dbh-quote(...).
--
Jeff japhy Pinyan % How can we ever be the sold
is that $u, your array index, is an ENORMOUS integer. You
need to find some other way to index your array.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been
, because $array[9] is the 10th element.
There is no variable that is magically the highest value in an array.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been
the grep
is matching jnormandin-p370-1691-SH to the jnormandin-p370-1691-SH-Cpu-2
string (as it is a substring of the second one).
Well, YES. That's because \b matches word boundaries. Between the 'H'
and the '-' is a word boundary.
--
Jeff japhy Pinyan % How can we ever be the sold short
gets saved. This is why you're getting only ONE letter in
$1.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org
a's or b's at the beginning of the string.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
()
This is because the * quantifier means that ZERO matches of that token is
a perfectly acceptable outcome. The regex got a match at the left-most
position it tried, so it uses that match.
LEFT-MOST, and from there, LONGEST.
--
Jeff japhy Pinyan % How can we ever be the sold short
it to be set from a web browser.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe
whatsoever,
I'd be more than happy to hear about it.
There's a wiki for the module at http://www.p3m.org/wiki?IRsCreen -- the
name IRsCreen is the proof-of-concept client that will be packaged with
IRC::Client.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother
in this case, the if() statement's condition is true, and you call
exit().
If system() or ``s fail, you should check $! to see the error message.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http
, but your assignment
to $ENV{HOME} doesn't happen until run-time. A simple fix in your case
is:
BEGIN {
$ENV{HOME} = /home/tony/cgi-bin;
}
use lib $ENV{HOME}/pm;
The BEGIN { } block forces its contents to be executed at compile-time.
--
Jeff japhy Pinyan % How can we ever
the duplicates are right after one another.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
?
Well, since fetchrow_array() returns a list (not an array, and not an
array ref), the best you can hope for right now is
$self-[1] = [ $selectHandle-fetchrow_array() ];
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who
On Jul 25, [EMAIL PROTECTED] said:
Can someone suggest a perl command line snippet that will print the last n
lines of a file.
The File::ReadBackwards module does it for you rather simply.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734
to $filename, and everything
from $_[1] to the end of @_ will correspond to the elements in @Data.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http
there (since there's no '.' or
'^' or '$' in the regex). But =20 is like %20 in a URL -- it represents a
space. As far as I can remember, it's another form of encoding
characters. You'd decode it in the same way:
$str =~ s/=([a-fA-F0-9]{2})/chr hex $1/eg;
--
Jeff japhy Pinyan
...
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED
into more detail about /o and regex
compilation (and have before, probably on this list), but for now, what
I've told you is all you need to know.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http
])}{
if ($1 eq '*') { '.*' }
else { \\$1 }
}eg;
If you wanted to support it here, you could end up doing
$temp1 =~ s{([^\w\s])}{
if ($1 eq '*') { '.*' }
elsif ($1 eq '?') { '.' }
else { \\$1 }
}eg;
--
Jeff japhy Pinyan % How can we ever be the sold short
On Jul 23, Tom Allison said:
Jeff 'japhy' Pinyan wrote:
The /o modifier tells the internal regex compiler that, after this regex has
been compiled 'o'nce, it is never to be compiled again. Well, what good is
that? you ask. For your average regex, there is absolutely no difference
'.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED
-- calling the test() function is
the same as calling the show() function.
For more on typeglobs, see 'perldoc perldata'.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have
. But using printf() needlessly is silly,
and in some cases, dangerous. If you have a % sign in your string, printf
will expect an argument to go with it.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http
,
but if you were to change them, for some reason, print()s output would be
affected (but printf()s would not).
print a, b, c; # abc
$, = !;
print a, b, c; # a!b!c
$\ = ?;
print a, b, c; # a!b!c?
But this is not likely to happen, methinks.
--
Jeff japhy Pinyan % How can we
on $_
This one-liner stores $_'s contents in $lineExtract, and THEN runs the
substitution on $lineExtract (keeping $_ intact):
(my $lineExtract = $_) =~ s/.../.../;
But again, I'm curious how you got stuff into $_ that you want to copy to
another location anyway.
--
Jeff japhy Pinyan % How
);
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED
: $!;
}
}
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL
:
print $_===\n for Today();
If Today() returns more than three values, then you could do:
print $_===\n for (Today())[0..2];
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org
to anchor the regex with ^ and $:
if ($temp2 =~ /^$temp1$/) { return 1 }
else { return 0 }
And while we're at it, you could just write:
return $temp2 =~ /^$temp1$/;
}
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who
), the
context changes how it behaves as well.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
at all, and just go to
XYZ, which might be a problem, given that (in your case) the label is
defined INSIDE a function.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have
$who = shift;
open GPG, ...;
if ($who eq 'mary') {
# ...
}
elsif ($who eq 'jim') {
# ...
}
close GPG;
}
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http
);
The list returned by Mamadoo..Lulu is empty.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
)+1, $tm-mday);
my $currentdate = ??
print ($currentdate);
my $currentdate = sprintf %04d%02d%02d, $tm-year+1900, ...;
You want sprintf() instead of print(), if you want to store the formatted
string instead of print it.
--
Jeff japhy Pinyan % How can we ever be the sold short
?
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED
to references. Further reading is:
perldoc perlref
perldoc perllol
perldoc perldsc
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http
toolbox
with a better way to do something. Every time John, Wiggins, Luke, Bob,
Jeff, etc. respond to my emails I know I'm going to learn something.
I don't think there's anything wrong with asking such questions.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia
::Zlib being sourced multiple times. How to avoid
this, I'm not sure. What version of CPAN.pm do you have? Perhaps a newer
version doesn't do this.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http
attribute hash, these are rep-
resented in it's contents by 3 tag-content pairs.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org
an object, which then has its f_one() method called.
But why this not works?
my $test = Test-new-f_one-f_two;
Because f_one() does not return an object!
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http
are produced by lookups on the table, or by a method call
which creates a brand new entry).
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http
class, or holding all the results in
memory at once. That sounds lazy[1] to me.
[1] as in, Laziness, Impatience, and Hubris, the three virtues of a Perl
programmer
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every
-{$ckey}\n;
}
Or you could even just do:
use Data::Dumper;
print Dumper($cluster);
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http
MyClient;
sub new {...}
package main;
my $client = MyClient-new;
$client-MyMixins::SomeMethod;
Yeah, that looks about right. Thrilling, wasn't it?
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http
of the DB based on the contents of the object
}
How's that sound?
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org
the '-' is not a valid word character (that is, it isn't matched by \w).
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org
INTO dev (batman, robin) VALUES (?, ?);
my $SQLQ2 = $MySQL2-prepare($SQLQ2a);
$SQLQ2-execute($FirstName, $LastName);
And, um, your variable-naming leaves a lot to be desired. $MySQL and
$MySQL2? $SQLQ1a, $SQLQ1, $SQLQ2a, $SQLQ2? I can't type those without
making typos first.
--
Jeff japhy
references, and their first
element is their UID, I've used $a-[0] = $b-[0] to compare those two
values. See the documentation for 'sort' (perldoc -f sort) for more
details.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who
On Jul 13, Beast said:
Jeff 'japhy' Pinyan wrote:
Is there any builtin function in perl to sort the above array based on uid,
username or fulname?
There is a built-in function to sort a list, yes. But the mechanism by
which to sort the list is, in this case, up to you to provide
On Jul 13, Ankur Gupta said:
Jeff 'japhy' Pinyan wrote:
Is there any builtin function in perl to sort the above array based
on uid, username or fulname?
my @sorted = sort {
$a-[0] = $b-[0]
} @employees;
Hey, This will sort only numbers. Will have no effect if the values have
text
::DATA.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL
japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED
On Jul 13, Jeff 'japhy' Pinyan said:
Or you could have a set() method:
sub set {
my $self = shift;
while (@_) {
my ($field, $value) = @_;
That should be:
my ($field, $value) = (shift, shift);
if (exists $self-{$field}) { $self-{$field} = $value }
else { die
}.
}}
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL
On Jul 13, Jeff 'japhy' Pinyan said:
# Subscriber::DB::get_greeting
sub get_greeting {
my ($self) = @_;
my $id = $self-{_id};
$greeting_sql-bind_columns(
\$self-{_salutation},
\$self-{_firstname},
\$self-{_lastname},
);
$greeting_sql-execute($id);
It turns out
{
my $class = shift;
my $self = bless {}, $class;
$self-set(@_);
return $self;
}
There's no need for that '%' prototype on your set() function, by the way.
Methods don't pay attention to prototypes, anyway.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI
(123.456,0) -- 123
round(123.456,1) -- 123.5
round(123.456,2) -- 123.46
It works with positive and negative numbers (both as the numbers BEING
rounded and the places to round TO).
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we
, we create an anonymous function (sub { ... }) and use it. This
anonymous function, when called, just calls the find_...(...) function.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http
of output
print $write $y\n;
chomp(my $z = $read); # read (and save) the next line of output
close $read;
close $write;
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have
reference containing
[/2005Jun01-Jun04xxx, 2005, 'Jun', '04'].
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org
a descriptive name).
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ %-- Meister Eckhart
--
To unsubscribe, e-mail
to numerical representations (Jan = 01, Dec
= 12), and then after you've sorted them (ASCIIbetically will work here)
you can change those numerical representations back to the month names.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734
101 - 200 of 1486 matches
Mail list logo