Re: not sure what $i stands for

2005-09-09 Thread Jeff 'japhy' Pinyan
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

Re: catchDate

2005-09-08 Thread Jeff 'japhy' Pinyan
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

Re: parsing long strings

2005-09-02 Thread Jeff 'japhy' Pinyan
=~ /([\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

Re: syntax Error ..........

2005-09-02 Thread Jeff 'japhy' Pinyan
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

Re: A newbe has a question relating to XML::Simple

2005-09-02 Thread Jeff 'japhy' Pinyan
$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

Re: syntax Error ..........

2005-09-02 Thread 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

Re: Find first day of every week in a month

2005-08-29 Thread Jeff 'japhy' Pinyan
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

Re: edit / seek woes

2005-08-29 Thread Jeff 'japhy' Pinyan
; 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

Re: @INC

2005-08-29 Thread Jeff 'japhy' Pinyan
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

Re: system (cd ..)

2005-08-29 Thread Jeff 'japhy' Pinyan
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

Re: Reg Closure in Perl

2005-08-25 Thread Jeff 'japhy' Pinyan
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

Re: regex stored in variables ?

2005-08-23 Thread Jeff 'japhy' Pinyan
. 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

Re: round up to nearest...

2005-08-22 Thread Jeff 'japhy' Pinyan
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

Re: round up to nearest...

2005-08-21 Thread Jeff 'japhy' Pinyan
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

Re: perl one liiner

2005-08-19 Thread Jeff 'japhy' Pinyan
] 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

Re: References Question

2005-08-19 Thread Jeff 'japhy' Pinyan
$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

Re: passing variables from perl to the system

2005-08-18 Thread Jeff 'japhy' Pinyan
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

Re: splitting data stream

2005-08-18 Thread Jeff 'japhy' Pinyan
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

Re: substring

2005-08-17 Thread Jeff 'japhy' Pinyan
; 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

Re: quantity discount calculation lookup tables

2005-08-15 Thread Jeff 'japhy' Pinyan
], 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

Re: quantity discount calculation lookup tables

2005-08-15 Thread Jeff 'japhy' Pinyan
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

Re: Sub-routine arguments

2005-08-12 Thread Jeff 'japhy' Pinyan
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

Puzzle: Know Your Data

2005-08-12 Thread Jeff 'japhy' Pinyan
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

Re: Misuse of use?

2005-08-12 Thread Jeff 'japhy' Pinyan
. 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

Re: Emptying a log file....

2005-08-11 Thread Jeff 'japhy' Pinyan
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

Re: use of backslash..

2005-08-10 Thread Jeff 'japhy' Pinyan
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

Re: help with pack/unpack

2005-08-09 Thread 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

Re: Seeding variables from command line

2005-08-09 Thread Jeff 'japhy' Pinyan
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

Re: more hashref within array sorting

2005-08-09 Thread Jeff 'japhy' Pinyan
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

Re: reference to subroutines

2005-08-08 Thread Jeff 'japhy' Pinyan
}) { $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

Re: Help with hash of dates

2005-08-08 Thread Jeff 'japhy' Pinyan
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

Re: creating my own include file

2005-08-07 Thread Jeff 'japhy' Pinyan
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

Re: substitution doesn't work on all files ?

2005-08-06 Thread Jeff 'japhy' Pinyan
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

Re: A better way.

2005-08-02 Thread Jeff 'japhy' Pinyan
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

Re: Running a subroutine

2005-08-02 Thread Jeff 'japhy' Pinyan
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

Re: I finally blew my TAINT

2005-08-02 Thread Jeff 'japhy' Pinyan
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

Re: perlstyle

2005-08-02 Thread Jeff 'japhy' Pinyan
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

Re: 'Use Lib' problem...

2005-08-01 Thread Jeff 'japhy' Pinyan
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

Re: escaping values (DBD::mysql)

2005-08-01 Thread Jeff 'japhy' Pinyan
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

Re: reference trouble

2005-08-01 Thread Jeff 'japhy' Pinyan
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

Re: $#{$array}

2005-07-29 Thread Jeff 'japhy' Pinyan
, 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

Re: Grep uniqueness issue

2005-07-29 Thread Jeff 'japhy' Pinyan
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

Re: regular expression match question

2005-07-29 Thread Jeff 'japhy' Pinyan
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

RE: regular expression match question

2005-07-29 Thread Jeff 'japhy' Pinyan
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

RE: regular expression match question

2005-07-29 Thread Jeff 'japhy' Pinyan
() 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

Re: login shell?

2005-07-27 Thread Jeff 'japhy' Pinyan
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

RFC: functionality/features of an IRC client

2005-07-27 Thread Jeff 'japhy' Pinyan
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

Re: system v backticks

2005-07-27 Thread Jeff 'japhy' Pinyan
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

Re: 'Use Lib' problem...

2005-07-26 Thread Jeff 'japhy' Pinyan
, 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

Re: skip/delete lines with dup keys

2005-07-26 Thread Jeff 'japhy' Pinyan
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

Re: how to obtain a reference to array which is returned by a function without intermediate array?

2005-07-25 Thread Jeff 'japhy' Pinyan
? 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

Re: perl newbie question

2005-07-25 Thread Jeff 'japhy' Pinyan
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

Re: Package/modual question -- more

2005-07-25 Thread Jeff 'japhy' Pinyan
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

Re: =20

2005-07-25 Thread Jeff 'japhy' Pinyan
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

Re: Get Image Dimensions

2005-07-25 Thread 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

Re: search and replace

2005-07-23 Thread Jeff 'japhy' Pinyan
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

Re: wildcard matching

2005-07-23 Thread Jeff 'japhy' Pinyan
])}{ 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

Re: search and replace

2005-07-23 Thread Jeff 'japhy' Pinyan
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

Re: is_int

2005-07-23 Thread 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

Re: pointer

2005-07-22 Thread Jeff 'japhy' Pinyan
-- 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

Re: Replcaing printf by print

2005-07-22 Thread Jeff 'japhy' Pinyan
. 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

RE: Replacing printf by print

2005-07-22 Thread Jeff 'japhy' Pinyan
, 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

Re: search and replace

2005-07-22 Thread Jeff 'japhy' Pinyan
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

Re: Help Please!!! External APP passing value to Perl

2005-07-22 Thread 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

Re: File::Find if match rename

2005-07-22 Thread 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

Re: Control Structure Question

2005-07-22 Thread Jeff 'japhy' Pinyan
: 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

Re: wildcard matching

2005-07-22 Thread Jeff 'japhy' Pinyan
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

Re: to () or not to (), that is the question.

2005-07-21 Thread Jeff 'japhy' Pinyan
), 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

Re: code improvement using LABELS within subroutines????

2005-07-21 Thread Jeff 'japhy' Pinyan
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

Re: code improvement using LABELS within subroutines????

2005-07-21 Thread Jeff 'japhy' Pinyan
$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

Re: slices of hashes

2005-07-21 Thread Jeff 'japhy' Pinyan
); 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

Re: Problems creating a simple variable

2005-07-21 Thread Jeff 'japhy' Pinyan
)+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

Re: A little Object Question

2005-07-21 Thread 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

Re: convert array pair to hash

2005-07-20 Thread Jeff 'japhy' Pinyan
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

Re: cool tricks for inserting element into array?

2005-07-20 Thread Jeff 'japhy' Pinyan
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

Re: installing modules using cpan

2005-07-20 Thread Jeff 'japhy' Pinyan
::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

Re: Help regarding XML::Parser

2005-07-20 Thread Jeff 'japhy' Pinyan
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

Re: OO in perl

2005-07-19 Thread Jeff 'japhy' Pinyan
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

Re: Object persistence

2005-07-19 Thread Jeff 'japhy' Pinyan
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

Re: Object persistence

2005-07-19 Thread Jeff 'japhy' Pinyan
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

Re: query about hash

2005-07-15 Thread Jeff 'japhy' Pinyan
-{$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

Re: mixin object method

2005-07-14 Thread Jeff 'japhy' Pinyan
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

Re: Object persistence

2005-07-14 Thread Jeff 'japhy' Pinyan
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

Re: Regular Expressions

2005-07-13 Thread Jeff 'japhy' Pinyan
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

Re: [Fwd: fetchrow_arrayref()]

2005-07-13 Thread Jeff 'japhy' Pinyan
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

Re: sorting list of array

2005-07-13 Thread Jeff 'japhy' Pinyan
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

Re: sorting list of array

2005-07-13 Thread Jeff 'japhy' Pinyan
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

RE: sorting list of array

2005-07-13 Thread Jeff 'japhy' Pinyan
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

Re: Access __END__ DATA from module/package

2005-07-13 Thread Jeff 'japhy' Pinyan
::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

Re: Object persistence

2005-07-13 Thread Jeff 'japhy' Pinyan
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

Re: Object persistence

2005-07-13 Thread Jeff 'japhy' Pinyan
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

Re: Array of hashes

2005-07-13 Thread 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

Re: Object persistence

2005-07-13 Thread Jeff 'japhy' Pinyan
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

Re: Object persistence

2005-07-13 Thread Jeff 'japhy' Pinyan
{ 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

Re: rounding in perl?

2005-07-12 Thread Jeff 'japhy' Pinyan
(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

Re: Query on File::Find

2005-07-07 Thread Jeff 'japhy' Pinyan
, 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

Re: FAQ

2005-07-07 Thread Jeff 'japhy' Pinyan
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

RE: Intelligent Sorting

2005-07-07 Thread Jeff 'japhy' Pinyan
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

RE: Emptying Arrays

2005-07-06 Thread Jeff 'japhy' Pinyan
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

Re: Intelligent Sorting

2005-07-06 Thread Jeff 'japhy' Pinyan
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

<    1   2   3   4   5   6   7   8   9   10   >