Re: recursive search

2005-12-02 Thread Jeff 'japhy' Pinyan
newlines, and add that to your running total. -- 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: Count number of times matched

2005-12-01 Thread Jeff 'japhy' Pinyan
it will match as many times as it can (due to the /g modifier). -- 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

Re: Interpolating variables in a string from a file

2005-12-01 Thread Jeff 'japhy' Pinyan
On Dec 1, Andrew Brosnan said: my $var = 'world'; my $data = DATA; __DATA__ hello $var Read 'perldoc -q expand'. -- 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

Re: formatting text

2005-11-29 Thread Jeff 'japhy' Pinyan
| {} |, $string ; does what you want. See the module's documentation for details. You'll have to download the module from CPAN, since I highly doubt you already have it. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we who for every

Re: Pattern Matching Question

2005-11-28 Thread Jeff 'japhy' Pinyan
]=ASDFGHJK, and @LargeArray[2]=SDFGHJKL So you want to get OVERLAPPING matches, is that correct? If so, your problem can be solved with a look-ahead assertion: my @matches = $string =~ /(?=($pattern.{8}))/g; The look-ahead matches without advancing in the string. -- Jeff japhy

Re: 15 Million RAW

2005-11-25 Thread Jeff 'japhy' Pinyan
: while (my @row = get_stuff_from_database()) { # assuming $row[0] is abc or def or ghi # that is, $row[0] holds the nickname of the function my $code = $functions{$row[0]}; $code-(@arguments); } So when $row[0] is 'abc', we call do_this(...). Etc. -- Jeff japhy Pinyan

Re: call ext prog - best way

2005-11-24 Thread Jeff 'japhy' Pinyan
for result code to indicate success/failure/virus found etc # if virus, return lines reporting it from @output # use map/grep/whatever to extract lines. } That's all I have to say about that. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated

Re: transforming numerous lists to a hash

2005-11-24 Thread Jeff 'japhy' Pinyan
the path is empty, instead of calling add_path() again, we set $_[0] to 1. This means that $hash{A}{B}{C}{1}{5} is set to 1. This can be done WITHOUT a recursive function. Exercise to the reader. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734

Re: regex mutil-line matching

2005-11-23 Thread Jeff 'japhy' Pinyan
as [\d\w|+] which is the same as [\w|+] anyway, since \w includes \d. So you could do: perl -00 -ane 'print $F[2] if $F[4] =~ /porn/' ... The -a switch autosplits $_ into @F on whitespace. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734

Re: Replacing a Bracketed String with N

2005-11-22 Thread Jeff 'japhy' Pinyan
, followed by a ']' with '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://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org/ %-- Meister Eckhart -- To unsubscribe, e

Re: rearranging a string

2005-11-21 Thread Jeff 'japhy' Pinyan
($string, 6, 2) . substr($string, 0, 4) The first argument is the OFFSET, and the second argument is the LENGTH. -- 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

Re: LWP package problem

2005-11-17 Thread Jeff 'japhy' Pinyan
On Nov 17, Pine Yan said: #!/home/gnu/bin/perl use LWP; my $browser = LWP::UserAgent-new; my $url = 'http://www.google.com'; my $response = $browser-get($url); You didn't load the LWP::UserAgent module, though. You loaded LWP, not LWP::UserAgent. -- Jeff japhy Pinyan% How can

Re: help explaining for this script

2005-11-16 Thread Jeff 'japhy' Pinyan
On Nov 16, Paul Johnson said: On Tue, Nov 15, 2005 at 06:48:40PM -0500, Jeff 'japhy' Pinyan wrote: whereas if $_[1] is tainted, then the eval { ... } returns false since a fatal error is raised because eval 1 . substr($_[0], 0, 0) is illegal if $_[0] is tainted. I would be wary of even

Re: help explaining for this script

2005-11-15 Thread Jeff 'japhy' Pinyan
if $_[0] is tainted. -- 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 -- To unsubscribe, e-mail: [EMAIL

Re: tricky problem about stat function

2005-11-13 Thread Jeff 'japhy' Pinyan
. It prints the NAME of the file. But that file doesn't exist in the current directory, it exists in the SCRATCH/BACKUP directory. You need to prepend the directory path to the filename: foreach (@files) { my $ctime = (stat SCRATCH/BACKUP/$_)[10]; } -- Jeff japhy Pinyan% How can we

Re: Is it possible with RegEx

2005-11-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://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org/ %-- Meister Eckhart -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: What am I doing wrong?

2005-11-08 Thread Jeff 'japhy' Pinyan
{ print $sku[$i-1],', totaalaantal is ', $t_qty[$i-1]\n; } } } } I believe the } above is the one matching your foreach statement. } $sth-finish; $dbh-disconnect; -- Jeff japhy Pinyan% How can we ever

RE: What am I doing wrong?

2005-11-04 Thread Jeff 'japhy' Pinyan
, you're running the same code TWICE (once for each element in @result). 1989, totaalaantal is 5 1989, totaalaantal is 5 4121, totaalaantal is 1 4121, totaalaantal is 1 Yup. Tweemaal. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated

Re: conditional use()

2005-11-04 Thread Jeff 'japhy' Pinyan
On Nov 4, JupiterHost.Net said: I'm beating my head against the wall trying to remember where I saw this / how to do this: In some documentation I remember seeing a use statement that had some sort of condition. use if ...; perldoc if -- Jeff japhy Pinyan% How can we ever

Re: Dates

2005-11-04 Thread Jeff 'japhy' Pinyan
you have the number of seconds in $gmtime. Subtract 8 hours by subtracting 60*60*8 seconds from that. -- 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

Re: hash of hash - copy

2005-11-04 Thread Jeff 'japhy' Pinyan
} = dclone($aSuit{0}); -- 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 -- To unsubscribe, e-mail

Re: What kind of structure to choice

2005-11-03 Thread Jeff 'japhy' Pinyan
= @{ $aref }; What are you doing that leads you to believe you'll need a special marker of some sort to indicate that an array has been processed? -- 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: regex issues

2005-11-01 Thread Jeff 'japhy' Pinyan
just use \Q...\E in the regex: my $splito = $dynparsparts[0]; ... my @parts = split /\Q$splito\E/, $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://www.perlmonks.org/ % have long ago been

Re: search and replace in html text

2005-10-28 Thread Jeff 'japhy' Pinyan
. (Guilt-free, I might add.) I'd suggest going to search.cpan.org and looking for HTML:: which should yield several matches. I think HTML::TokeParser (or HTML::TokeParser::Simple) would be your best bet here. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother

Re: help slurping a file-- Solved -- Thanks for responses

2005-10-28 Thread Jeff 'japhy' Pinyan
. That's weird. I don't use a Mac, though, so I can't be sure.) -- 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

Re: finding the first non digit character in a string

2005-10-28 Thread Jeff 'japhy' Pinyan
(\.) and digits after 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://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org/ %-- Meister Eckhart -- To unsubscribe, e-mail: [EMAIL

Re: How to decode raw G3 data to plain txt file

2005-10-26 Thread Jeff 'japhy' Pinyan
no idea. -- 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 -- To unsubscribe, e-mail: [EMAIL

Re: regular expression match problem

2005-10-25 Thread Jeff 'japhy' Pinyan
. P.S. My last name is Pinyan (awfully close to your full name). It's pronounced the same way, I'm told, as pinyin, the process by which Chinese characters are transliterated into English words. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734

Re: Troubles getting a value out of an XML object

2005-10-24 Thread Jeff 'japhy' Pinyan
' from $data, but you don't know how to get 'RecordNumber' from $data-{CreateLock}? my $rec = $data-{CreateLock}-{RecordNumber}; # or, without the extra - my $rec = $data-{CreateLock}{RecordNumber}; The object is merely a hash of hashrefs (of hashrefs, etc.). -- Jeff japhy Pinyan

Re: Module subclassing (solved)

2005-10-24 Thread Jeff 'japhy' Pinyan
opinion. Those should be set up as methods of the object. :( The idiom: package Class::Subclass; use base 'Class'; 1; should be universal, no? -- 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: map/array performance

2005-10-23 Thread Jeff 'japhy' Pinyan
map() in void context), you're wasting resources. If you do map BLOCK LIST and don't intend on saving the return value of map(), just use a for loop. for (LIST) BLOCK -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we who

Re: map/array performance

2005-10-23 Thread Jeff 'japhy' Pinyan
() is even better. -- 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 -- To unsubscribe, e-mail: [EMAIL

getting authors' names right (was Re: Project planning)

2005-10-22 Thread Jeff 'japhy' Pinyan
Conway's name spelled properly, and Randal (L.) Schwartz's name spelled properly, etc. I see Damien and Randall constantly. -- 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

Re: Removing specific lines from a File

2005-10-21 Thread Jeff 'japhy' Pinyan
references. Here's what it's like: @records = ( # email 1 { SENDER = '...', RECIPIENT = [ '...', '...' ], SMTP = '...', # whatever other fields you want }, # email 2 { ... }, ); -- Jeff japhy Pinyan% How can we ever be the sold short or RPI

Re: killing a program

2005-10-21 Thread Jeff 'japhy' Pinyan
(); kill 1,$fPID; That's sending it a HUP signal. Do you expect PROGRAM to die when it receives the HUP signal? kill 9,$fPID1; NOW it should die, since 9 is KILL. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we

Re: net::google problem

2005-10-20 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://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org/ %-- Meister Eckhart -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: HTAB, VTAB in a terminal?

2005-10-20 Thread Jeff 'japhy' Pinyan
? The Curses module is probably a good starting point. It gives you control over the terminal displays. Curses! Foiled again! -- 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

Re: HTAB, VTAB in a terminal?

2005-10-20 Thread Jeff 'japhy' Pinyan
? Or can I simply embed that module within my script somehow? It's not that easy. Curses is a wrapper around a bunch of C functions and what-not. I don't know what the simplest non-Curses way of controlling a terminal is. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI

Re: white space between roam and act

2005-10-19 Thread Jeff 'japhy' Pinyan
) You're misunderstanding the /x modifier. Using /x means that all whitespace in your regex is ignored, not that all whitespace in the STRING is ignored. Only roamact is matched by /roam act/x, since the in the regex is ignored due to the /x modifier. -- Jeff japhy Pinyan% How can we

Re: white space between roam and act

2005-10-19 Thread Jeff 'japhy' Pinyan
as perl myprog.plroamact both of which create TWO arguments, one 'roam', and the other 'act'. -- 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

Re: How to build an executable on Windows

2005-10-19 Thread Jeff 'japhy' Pinyan
On Oct 19, kathyjjja said: $ftp = Net::FTP-new(aaa.bbb.org, Debug =0) or die Cannot connect to aaa.bbb.org: $@; $ftp-ascii $ftp-login(login,passwd) or die Cannot login, $ftp-message; You missed the semicolon after '$ftp-ascii'. -- Jeff japhy Pinyan% How can we ever be the sold

Re: which perldoc ?

2005-10-19 Thread Jeff 'japhy' Pinyan
summary of their purpose. You should see 'perlrun' listed as the one describing the command-line options to perl. -- 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

Re: which perldoc ?

2005-10-19 Thread Jeff 'japhy' Pinyan
On Oct 19, Randy W. Sims said: Jeff 'japhy' Pinyan wrote: On Oct 19, Brian Volk said: Is there a perldoc that will list the available arguments and there meanings for perl-one-liners? Yes. To try and figure out what perldoc to look at for a given topic, do: perldoc perldoc You mean

Re: Destroying an object

2005-10-18 Thread Jeff 'japhy' Pinyan
(), because you can't modify a constant string: trim( hello ); # run-time fatal error -- 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

Re: Quering Msql database from perl

2005-10-14 Thread Jeff 'japhy' Pinyan
. In the future, please determine the appropriate list for your questions. $statement = q{ SELECT * FROM some_table ORDER BY votes DESC LIMIT 1 }; That will get you one row back, the row with the highest votes. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI

Re: non-ascii characters?

2005-10-14 Thread Jeff 'japhy' Pinyan
On Oct 14, Charles Farinella said: Does anyone know how I can search for non-ascii characters in a text file? By non-ASCII, do you mean characters high-bit ASCII or Unicode? -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we who

Re: XML::XPath query

2005-10-14 Thread Jeff 'japhy' Pinyan
to use double-quotes around the entire string and escape whatever shouldn't be interpolated: $xp-findnodes(/navigator/nav_group/[EMAIL PROTECTED] = '$script']); Try that. I don't see anything explaining the syntax of an XML path, so I don't really know what *I'm* doing. -- Jeff japhy

Re: Lexical Analysis and Parsing in Perl

2005-10-13 Thread Jeff 'japhy' Pinyan
::RecDescent. For written language parsing, those are located in the Lingua:: hierarchy on CPAN. -- 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

Re: regd. regular. expression.

2005-10-13 Thread Jeff 'japhy' Pinyan
allow for a newline at the end of the string, whereas \z does not. Perhaps, though, it's overkill, since you're already making sure $match only has 3 characters. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we who for every service

Re: Simple Substition Question

2005-10-13 Thread Jeff 'japhy' Pinyan
($text3). Perhaps if you put something in $text3 FIRST, and THEN tried s///'ing 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://www.perlmonks.org/ % have long ago been overpaid? http

Re: Using Perl Modules

2005-10-11 Thread Jeff 'japhy' Pinyan
? By telling it so, with the 'lib' pragma: #!/usr/bin/perl use lib /home/japhy/modules; use MySpecialModule; # /home/japhy/modules/MySpecialModule.pm Read 'perldoc lib'. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we who

Re: Regex matching problem

2005-10-11 Thread Jeff 'japhy' Pinyan
/; push @info, $answer; } And then you loop through it like so: for my $idx (0 .. $#info) { print $idx + 1, : $info[$idx]\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://www.perlmonks.org

Re: random #

2005-10-09 Thread Jeff 'japhy' Pinyan
shuffle -- 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 -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: Skipping blank lines while reading a flat file.

2005-10-07 Thread Jeff 'japhy' Pinyan
to skip lines that only have whitespace characters, then you can do: while (FH) { chomp; next unless /\S/; } -- 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

Re: Find and replace problem

2005-10-06 Thread Jeff 'japhy' Pinyan
.connectionType_changed_changed by making sure that the Ethernet0.connectionType is not followed by _changed -- that's what the (?!_changed) part of the regex is doing. -- 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: Sorting hash of hashes

2005-10-06 Thread Jeff 'japhy' Pinyan
{$a} and $message{$b}. To sort my the 'To_Num' field, then, you would do: sort { $message{$a}{To_Num} = $message{$b}{To_Num} } keys %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://www.perlmonks.org

Re: Split with backslashes?

2005-10-05 Thread Jeff 'japhy' Pinyan
. '\' is a BACK slash. Here are two solutions to your problem: my @dirs = split /\//, $cd; # splitting on forward slashes my @dirs = split '/', $cd; # same thing, less ugly -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we who

RE: Extracting Upper case letter from a variable

2005-10-05 Thread Jeff 'japhy' Pinyan
it; that's how we put something in $ORACLE_SID other than '1'. ($ORACLE_SID) = $basename =~ /_([A-Z]+)-/; -- 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

Re: Problems with set-request NET::SNMP - retransmited

2005-10-05 Thread Jeff 'japhy' Pinyan
.. are. If that fails, try # \x0c \x01, which is using actual hexadecimal escape sequences to produce character 10 and character 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://www.perlmonks.org

Re: looking for duplicate array values

2005-10-05 Thread Jeff 'japhy' Pinyan
from there. -- 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 -- To unsubscribe, e-mail: [EMAIL

Re: looking for duplicate array values

2005-10-05 Thread Jeff 'japhy' Pinyan
}++; # test printout print $sku [$hash{$sku}]\n if $verbose; You don't really need $sku here... but you can use it if you wish. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we who for every service http

Mail::IMAPClient failing [was Re: Please help]

2005-10-05 Thread Jeff 'japhy' Pinyan
as $login:$pass: $@; as the documentation for the module suggests. $@ will hold the reason for the failure. -- 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

Re: Deprecated perl hash reference statement problem

2005-10-04 Thread Jeff 'japhy' Pinyan
} and $$array[$idx]. -- 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 -- To unsubscribe, e-mail: [EMAIL

Re: Deprecated perl hash reference statement problem

2005-10-04 Thread Jeff 'japhy' Pinyan
to [$value]br; #Debug } } Blech! Please, please, PLEASE use CGI.pm for your form-parsing needs. It's standard and it works, and it handles things like multiple-value select-boxes (which get_form_data_1() does not). -- Jeff japhy Pinyan% How can we ever be the sold short or RPI

Re: Deprecated perl hash reference statement problem

2005-10-04 Thread Jeff 'japhy' Pinyan
but sometimes confusing as hell (to me at least). Consider reading 'perldoc perlreftut', a tutorial to using references. -- 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

Re: sort with special order

2005-10-03 Thread Jeff 'japhy' Pinyan
to address this situation :( I would use map() before and after sort() to correct leading characters. my @sorted = map { tr/123/QBZ/; $_ } sort map { tr/QBZ/123/; $_ } @data; -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734

Re: [SPAM DETECT] Re: sort with special order

2005-10-03 Thread Jeff 'japhy' Pinyan
On Oct 3, Xavier Noria said: On Oct 3, 2005, at 18:16, Jeff 'japhy' Pinyan wrote: my @sorted = map { tr/123/QBZ/; $_ } sort map { tr/QBZ/123/; $_ } @data; There's a potential gotcha there: since all Qs and Bs are being swapped lexicographic order after the first character

Re: sort with special order

2005-10-03 Thread Jeff 'japhy' Pinyan
they are in order of Q, B , then Z Any ideas or input on how to efficiently do that with sort() or even map() is most appreciated :) perldoc -f sort|-f map didn't appear to address this situation :( Jeff 'japhy' Pinyan wrote: I would use map() before and after sort() to correct leading characters

Re: use strict, aliases, local

2005-10-02 Thread Jeff 'japhy' Pinyan
your global variables: use strict; our ($foo, @foo); $foo = ...; @foo = ...; testsub(*foo); sub testsub { our ($x, @x); *x = $_[0]; $x++; push @x, 100; } But this is really inadvisable. What is your motivation to do this kind of thing? -- Jeff japhy Pinyan

Re: Dealing with Uninitialized values in an array and DBI?

2005-10-01 Thread Jeff 'japhy' Pinyan
wrong here. my @ary = (); That's doing nothing -- you're creating a NEW lexical named @ary. Drop the my(), but I'm not even sure it's necessary. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we who for every service

Re: Comparing an array with hash keys

2005-09-30 Thread Jeff 'japhy' Pinyan
{$_} : () } @original_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://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org/ %-- Meister Eckhart -- To unsubscribe, e-mail: [EMAIL

Re: question about # of files in a directory

2005-09-30 Thread Jeff 'japhy' Pinyan
the directory $path in the array @files. The number of elements is the number of files. -- 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

Re: generating a wordlist from an array of arrays

2005-09-29 Thread Jeff 'japhy' Pinyan
to do this on your own, and yes, recursion is the most obvious way to do 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://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org

Re: a little help...

2005-09-28 Thread Jeff 'japhy' Pinyan
\n; $matched = $matches; $matches = 0; Where did $matched come from? } } } } close (OUTPUT); close (OUTPUT2); } You should not use any variables in a function that you did not pass to it or create IN it. -- Jeff japhy Pinyan% How can we

Re: Block Confusion

2005-09-27 Thread Jeff 'japhy' Pinyan
) { You're using the /o modifier here, and that's causing your problem. I'm guessing you don't actually know what the /o modifier does. It tells Perl the regex won't change after it's been compiled the first time. Remove the /o modifier and I believe your code will run fine. -- Jeff japhy

Re: eval without warnings

2005-09-27 Thread Jeff 'japhy' Pinyan
that expression is returned. -- 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 -- To unsubscribe, e-mail

RE: Hash Problem

2005-09-25 Thread Jeff 'japhy' Pinyan
On Sep 23, Ryan Frantz said: From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED] foreach my $process (in $sobj-InstancesOf(Win32_LogicalDisk)) { next if $ignoreDriveTypes{ $process-{DriveType} }; So this would evaluate to true if $process-{DriveType} matches a key in the hash? It would

Re: reusing DBI statement handle

2005-09-23 Thread Jeff 'japhy' Pinyan
* Perl has seen its prototype. Long story short: don't use prototypes. -- 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

Re: how do I grep and have the matched single line in perl variable

2005-09-23 Thread Jeff 'japhy' Pinyan
returned by `my_utility` that have 'manish' in them: my @wanted = grep /manish/, `my_utility`; -- 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

Re: here tag and internal variable

2005-09-23 Thread Jeff 'japhy' Pinyan
On Sep 23, Frank Geueke, III said: text immediately following the variable name. How do I tell Perl that the text is not part of the variable name? Here's my code: You wrap the *name* of the variable in braces: print ${get_to_index}css/hotspot.css; -- Jeff japhy Pinyan% How can

Re: Looking for perl scripts to remove ^M

2005-09-23 Thread Jeff 'japhy' Pinyan
platforms come with a program called 'dos2unix' or something similar. You don't really need Perl to do this. A simple 'tr' command will work: tr -d '\r' '' file.in file.out -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we who

Re: Hash Problem

2005-09-23 Thread Jeff 'japhy' Pinyan
, not the $process foreach loop. You'd have had to put a label on the outer foreach loop like so: PROCESS: foreach my $process (...) { foreach (...) { next PROCESS if ...; } ... } -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734

Re: Reverse If and Normal Else

2005-09-22 Thread Jeff 'japhy' Pinyan
') ? display_nothing() : display_something(); is like saying if ($match_type eq 'none') { display_nothing(); } else { display_something(); } -- 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: Regular expression in varaible

2005-09-22 Thread Jeff 'japhy' Pinyan
-of-string anchor, so there's no way an 'i' can match after it. Were you hoping the '$i' would be expanded to the current value of the $i variable? -- 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: Reverse If and Normal Else

2005-09-22 Thread Jeff 'japhy' Pinyan
{ } around the statement: $result = do { do_this() if that(); }; -- 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

Re: Regular expression in varaible

2005-09-22 Thread Jeff 'japhy' Pinyan
On Sep 22, Michael Gale said: Jeff 'japhy' Pinyan wrote: On Sep 22, Michael Gale said: I have the following line of code and I believe it is correct, but it is not doing what I am expecting it to do: Config file [test] value=^OK$i The problem is that '^OK$i' as a string turned

Re: Is it possible to force a particular order in a hash?

2005-09-22 Thread Jeff 'japhy' Pinyan
if you're going to be using multidimensional hashes). Look for either module on CPAN (http://search.cpan.org/). -- 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

Re: Splitting on =

2005-09-21 Thread Jeff 'japhy' Pinyan
. There's no bug. You're doing something wrong. If you show us a bit more code, that demonstrates how you're using the function, we might be able to help more. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we who for every service

Re: Package require question again

2005-09-19 Thread Jeff 'japhy' Pinyan
type. To get the scalar variable found in the glob, you have to dereference the glob as if it were a scalar: my $g = $main::{$Player{Location} . ::}{Options}; my $value = $$g; or, as one line: my $value = ${ $main::{$Player{Location} . ::}{Options} }; -- Jeff japhy Pinyan% How

Re: Package require question again

2005-09-19 Thread Jeff 'japhy' Pinyan
On Sep 19, Luinrandir said: From: Jeff 'japhy' Pinyan [EMAIL PROTECTED] my $g = $main::{$Player{Location} . ::}{Options}; my $value = $$g; or, as one line: my $value = ${ $main::{$Player{Location} . ::}{Options} }; is the double $$ in $$g a mistake or real? If it was a typo

Re: keys of hash of hashes

2005-09-16 Thread Jeff 'japhy' Pinyan
', whereas $hash-{$key} means that you have a hash reference stored in $hash. Your print() line, therefore, should be: print keys %{ $ref_allTariffData-{$filename} }; -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we who for every

Re: How to Update Hash to Itself Recursively

2005-09-16 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://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org/ %-- Meister Eckhart -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: how do I know if it's an array?

2005-09-15 Thread Jeff 'japhy' Pinyan
/perl use CGI; $query = CGI-new; $which_box = $query-param('some_radio_button_name'); @colors = $query-param('some_check_box_name'); and it's taken care of for you. -- Jeff japhy Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% the cheated, we who

Re: Why wont this work? Package require question

2005-09-14 Thread Jeff 'japhy' Pinyan
, array, hash, etc.), we do $glob-(ARGS). -- 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: strange result with reg exp

2005-09-14 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://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org/ %-- Meister Eckhart -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: Algorithm Help Needed

2005-09-13 Thread Jeff 'japhy' Pinyan
until the first 12 had been sent. The extreme cases are the easy ones, though. What I'd like to see are cases like: foo = 1 bar = 2 qux = 3 baz = 4 zip = 5 Once I know what the algorithm's outcome should be for something like that, I think I can develop it. -- Jeff japhy Pinyan

RE: Use of uninitialized value

2005-09-13 Thread Jeff 'japhy' Pinyan
us WHICH of those lines produced the warning 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://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org/ %-- Meister

Re: Problem with backtick command to compile a perl program

2005-09-13 Thread Jeff 'japhy' Pinyan
the IPC::Open3 module, which comes with Perl. -- 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: Use of uninitialized value in concatenation (.) or string at txt.pl line 33, IN line 11

2005-09-12 Thread Jeff 'japhy' Pinyan
the (NUMBER) part optional without causing $2 to be undef if it isn't matched. -- 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

Re: [:alpha:]

2005-09-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://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org/ %-- Meister Eckhart -- To unsubscribe, e-mail: [EMAIL

  1   2   3   4   5   6   7   8   9   10   >