Re: recursive search

2005-12-02 Thread Jeff 'japhy' Pinyan
n it, count its 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/ %

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__ 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.pe

Re: Count number of times matched

2005-12-01 Thread Jeff 'japhy' Pinyan
instead of scalar context), so 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 bee

Re: formatting text

2005-11-29 Thread Jeff 'japhy' Pinyan
better fashion. use Perl6::Form; print form "| {} |", $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

Re: From column to row?

2005-11-28 Thread Jeff 'japhy' Pinyan
ng in $_ print qq{"$_",}; } The qq{...} is a double-quoted string; that is, it's the same as "..." except that it doesn't use " to delimit the string, but rather { and }. This isn't a perfect solution for you, though, because it keeps a t

Re: Pattern Matching Question

2005-11-28 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 PROTE

Re: 15 Million RAW

2005-11-25 Thread Jeff 'japhy' Pinyan
p;... things are REFERENCES to functions. So you do: 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 'a

Re: transforming numerous lists to a hash

2005-11-24 Thread Jeff 'japhy' Pinyan
, when 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

Re: call ext prog - best way

2005-11-24 Thread Jeff 'japhy' Pinyan
, either parenthesize specifically, or avoid trouble by using the loosely-binding 'or' operator: chdir($ARGV[0]) || die ...; chdir $ARGV[0] or die ...; foreach my $engine (%engines) { You're looping over the keys AND values of the hash. You mean to say foreach my $engine (k

Re: regex mutil-line matching

2005-11-23 Thread Jeff 'japhy' Pinyan
*porn/m }' Your regexes are funky. First of all, [...] is for CHARACTERS. [\d+|\w+] is the same 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 w

Re: Replacing a Bracketed String with "N"

2005-11-22 Thread Jeff 'japhy' Pinyan
es a '[' followed by A's, C's, T's, and/or G's, 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.perlm

Re: rearranging a string

2005-11-21 Thread Jeff 'japhy' Pinyan
) . substr($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.or

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 "j

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 wa

Re: help explaining for this script

2005-11-15 Thread Jeff 'japhy' Pinyan
false 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. -- Jeff "japhy" Pinyan% How can we ever be the sold short or RPI Acacia Brother #734% th

Re: tricky problem about stat function

2005-11-13 Thread Jeff 'japhy' Pinyan
quot; print $_ " successfully prints out the files in SCRATCH/BACKUP dir. 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) {

Re: Is it possible with RegEx

2005-11-09 Thread Jeff 'japhy' Pinyan
mplest way to do this is: if ("123" =~ /1.*3/) { print "found 1...3\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 lon

Re: What am I doing wrong?

2005-11-08 Thread Jeff 'japhy' Pinyan
if($i==$n){ print "$sku[$i-1]",', totaalaantal is ', "$t_qty[$i-1]\n"; print "$sku[$i]",', totaalaantal is ', "$t_qty[$i]\n"; } else {

Re: hash of hash - copy

2005-11-04 Thread Jeff 'japhy' Pinyan
level deep. For generic copying of data structures, see the Storable module (comes with Perl): use Storable; $aSuit{1} = 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 h

Re: Dates

2005-11-04 Thread Jeff 'japhy' Pinyan
t;2005-11-02 01:36:00.0", "UTC"); Now 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 s

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

RE: What am I doing wrong?

2005-11-04 Thread Jeff 'japhy' Pinyan
uld've used $i to fill in the placeholder. foreach (my @result = $sth->fetchrow_array) { That is certainly incorrect. I think you just want to do: my @result = $sth->fetchrow_array; and dispense with the loop entirely. Otherwise, you're running the same code TWICE (once

Re: What kind of structure to choice

2005-11-03 Thread Jeff 'japhy' Pinyan
$size = @{ $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 fo

Re: regex issues

2005-11-01 Thread Jeff 'japhy' Pinyan
to/, $problem; or to keep $splito normal, you can 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 f

Re: finding the first non digit character in a string

2005-10-28 Thread Jeff 'japhy' Pinyan
optionally allowing for a decimal point (\.) 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/

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

2005-10-28 Thread Jeff 'japhy' Pinyan
f the line. (Except maybe on Macs, I don't know. 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 ht

Re: search and replace in html text

2005-10-28 Thread Jeff 'japhy' Pinyan
off using a module to do it for you. (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

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

2005-10-26 Thread Jeff 'japhy' Pinyan
rsing this format, I have absolutely 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

Re: regular expression match problem

2005-10-25 Thread Jeff 'japhy' Pinyan
tes any regex-related characters, so that they're matched literally. 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"

Re: Module subclassing (solved)

2005-10-24 Thread Jeff 'japhy' Pinyan
That's poor planning, in my 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 Brothe

Re: Troubles getting a value out of an XML object

2005-10-24 Thread Jeff 'japhy' Pinyan
*Question:* How do I get the value of RecordNumber? You knew how to get 'CreateLock' 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 =

Re: map/array performance

2005-10-23 Thread Jeff 'japhy' Pinyan
val . And as John has shown, join() 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/

Re: map/array performance

2005-10-23 Thread Jeff 'japhy' Pinyan
ilds a list to be returned, and by not USING its return value (that is, calling 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" Piny

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

2005-10-22 Thread Jeff 'japhy' Pinyan
ly appreciate seeing Damian 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% th

Re: killing a program

2005-10-21 Thread Jeff 'japhy' Pinyan
= findPID(); 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 Broth

Re: Removing specific lines from a File

2005-10-21 Thread Jeff 'japhy' Pinyan
etc. } Now you have an array, @records, whose elements are hash references. Here's what it's like: @records = ( # email 1 { SENDER => '...', RECIPIENT => [ '...', '...' ], SMTP => '...', # whatever other

Re: HTAB, VTAB in a terminal?

2005-10-20 Thread Jeff 'japhy' Pinyan
hines? 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

Re: HTAB, VTAB in a terminal?

2005-10-20 Thread Jeff 'japhy' Pinyan
rent terminal? 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

Re: Carriage Return and LineFeeds Question

2005-10-20 Thread Jeff 'japhy' Pinyan
is not much to talk about. ^P Here is a "long" paragraph, but I only mean that the length of its lines are considerably longer. ^P And here is the last paragraph which I have made taller than all the other ones. Remember when paragraphs were more than two sentences long? ===

Re: net::google problem

2005-10-20 Thread Jeff 'japhy' Pinyan
cumentation! Let the author 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://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org/ %-- Meister Eckhart -- T

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

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.or

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

Re: white space between roam and act

2005-10-19 Thread Jeff 'japhy' Pinyan
s the same 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://w

Re: white space between roam and act

2005-10-19 Thread Jeff 'japhy' Pinyan
ct/ix) 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. -- Jef

Re: Destroying an object

2005-10-18 Thread Jeff 'japhy' Pinyan
rint "[EMAIL PROTECTED]"; # [this and that] Of course, you can't send an ACTUAL string to trim(), 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

Re: XML::XPath query

2005-10-14 Thread Jeff 'japhy' Pinyan
27;t see anything explaining the syntax of an XML path, so I don't really know what *I'm* 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://www.perlmonks.org/ % ha

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 c

Re: Quering Msql database from perl

2005-10-14 Thread Jeff 'japhy' Pinyan
but I will answer it for you. 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

Re: Simple Substition Question

2005-10-13 Thread Jeff 'japhy' Pinyan
you that you're using an uninitialized value ($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 htt

Re: regd. regular. expression.

2005-10-13 Thread Jeff 'japhy' Pinyan
mean "end of string", except that $ can 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 sho

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 over

Re: Regex matching problem

2005-10-11 Thread Jeff 'japhy' Pinyan
a non-whitespace character in it $answer = "-" if $answer !~ /\S/; 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

Re: Using Perl Modules

2005-10-11 Thread Jeff 'japhy' Pinyan
e for a module?" 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

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

Re: Skipping blank lines while reading a flat file.

2005-10-07 Thread Jeff 'japhy' Pinyan
e () { chomp; next if $_ eq ""; ... } If you want to skip lines that only have whitespace characters, then you can do: while () { chomp; next unless /\S/; } -- Jeff "japhy" Pinyan% How can we ever be the sold short or RPI Acacia Brothe

Re: Sorting hash of hashes

2005-10-06 Thread Jeff 'japhy' Pinyan
ting -- this means they're two keys from %message. This means the ONLY place it makes sense for them to be is $message{$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 &

Re: Find and replace problem

2005-10-06 Thread Jeff &#x27;japhy&#x27; Pinyan
27;t change "Ethernet0.connectionType_changed" to "Ethernet0.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" Pinya

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

2005-10-05 Thread Jeff &#x27;japhy&#x27; Pinyan
) or die "couldn't connect to $imaphost 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

Re: looking for duplicate array values

2005-10-05 Thread Jeff &#x27;japhy&#x27; Pinyan
$sku = $array[0]; $hash{$sku}++; # 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

Re: looking for duplicate array values

2005-10-05 Thread Jeff &#x27;japhy&#x27; Pinyan
guide you 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 unsubsc

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

2005-10-05 Thread Jeff &#x27;japhy&#x27; Pinyan
he Net::SNMP docs only show ONE example of using OCTET_STRING, and I'm not really sure what its rules about using "0x.." are. If that fails, try "# \x0c \x01", which is using actual hexadecimal escape sequences to produce character 10 and character 1. -- Jeff "japhy&q

RE: Extracting Upper case letter from a variable

2005-10-05 Thread Jeff &#x27;japhy&#x27; Pinyan
;ve added tell Perl to capture what it matched with [A-Z]+ and return 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

Re: Split with backslashes?

2005-10-05 Thread Jeff &#x27;japhy&#x27; Pinyan
a FORWARD slash. '\' 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

Re: Deprecated perl hash reference statement problem

2005-10-04 Thread Jeff &#x27;japhy&#x27; Pinyan
l feature 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:/

Re: Deprecated perl hash reference statement problem

2005-10-04 Thread Jeff &#x27;japhy&#x27; Pinyan
hash <- Deprecated stmt print "get_form_data_1: Setting $key to [$value]"; #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

Re: Deprecated perl hash reference statement problem

2005-10-04 Thread Jeff &#x27;japhy&#x27; Pinyan
>[$idx], or $$hash{$key} 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/ %-- Meiste

Re: sort with special order

2005-10-03 Thread Jeff &#x27;japhy&#x27; Pinyan
or Z >>> >>> I need to sort them so 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 situati

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

2005-10-03 Thread Jeff &#x27;japhy&#x27; 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

Re: sort with special order

2005-10-03 Thread Jeff &#x27;japhy&#x27; Pinyan
ar 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 o

Re: multiple overlapping matches in a regex

2005-10-03 Thread Jeff &#x27;japhy&#x27; Pinyan
onsume) for the following pattern ...". -- 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: use strict, aliases, local

2005-10-02 Thread Jeff &#x27;japhy&#x27; Pinyan
this is really inadvisable. What is your motivation to do this kind of thing? -- 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://princ

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

2005-10-01 Thread Jeff &#x27;japhy&#x27; Pinyan
ot;, \"${ary[18]}\", \"${ary[19]}\", \"${ary[20]}\", \"${ary[21]}\", \"${ary[22]}\", \"${ary[23]}\", \"${ary[24]}\", \"${ary[25]}\", \"${ary[26]}\", \"${ary[27]}\", \"${ary[28]}\", \"${a

Re: question about # of files in a directory

2005-09-30 Thread Jeff &#x27;japhy&#x27; Pinyan
the files from 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 lon

Re: Comparing an array with hash keys

2005-09-30 Thread Jeff &#x27;japhy&#x27; 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-ma

Re: generating a wordlist from an array of arrays

2005-09-29 Thread Jeff &#x27;japhy&#x27; Pinyan
got no idea about it right now. and sorry for my bad english, hope i can make my problem understandable. It would be a fun exercise 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

Re: a little help...

2005-09-28 Thread Jeff &#x27;japhy&#x27; Pinyan
UT2 "$ip1\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"

Re: Anonymous Reference Question

2005-09-28 Thread Jeff &#x27;japhy&#x27; Pinyan
27; => 60, 'tom' => 50 }; QUESTION: Does this mean that $grades is an anonymous reference because perl gives is $VAR1? No, it's just what Data::Dumper outputs when you don't assign a name to the data structure you pass it. See the Data::Dumper docs.

Re: eval without warnings

2005-09-27 Thread Jeff &#x27;japhy&#x27; Pinyan
handler). If there is an error or warning, the expression itself is returned; otherwise, the returned value from 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

Re: Block Confusion

2005-09-27 Thread Jeff &#x27;japhy&#x27; Pinyan
the /o modifier and I believe your code will run fine. -- 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: Hash Problem

2005-09-25 Thread Jeff &#x27;japhy&#x27; 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} ma

Re: Hash Problem

2005-09-23 Thread Jeff &#x27;japhy&#x27; Pinyan
$type ( keys %ignoreDriveTypes ) { next if ( $process->{DriveType} == $ignoreDriveTypes{$type} ); } Here was the problem. This 'next' was working on THIS foreach loop, not the $process foreach loop. You'd have had to put a label on the outer foreach loop like so:

Re: Looking for perl scripts to remove ^M

2005-09-23 Thread Jeff &#x27;japhy&#x27; 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 so

Re: here tag and internal variable

2005-09-23 Thread Jeff &#x27;japhy&#x27; 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&q

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

2005-09-23 Thread Jeff &#x27;japhy&#x27; Pinyan
ments 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/ % ha

Re: reusing DBI statement handle

2005-09-23 Thread Jeff &#x27;japhy&#x27; Pinyan
But this is never noticed because you've called the function *before* 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 f

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

2005-09-22 Thread Jeff &#x27;japhy&#x27; Pinyan
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/ % hav

Re: Regular expression in varaible

2005-09-22 Thread Jeff &#x27;japhy&#x27; 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

Re: Reverse If and Normal Else

2005-09-22 Thread Jeff &#x27;japhy&#x27; Pinyan
his()); $result = (that() && do_this()); However, you can turn any statement into an expression by using do { } 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% t

Re: Regular expression in varaible

2005-09-22 Thread Jeff &#x27;japhy&#x27; Pinyan
' is the end-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 Brothe

Re: Reverse If and Normal Else

2005-09-22 Thread Jeff &#x27;japhy&#x27; Pinyan
operator: ($match_type eq 'none') ? 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 Aca

Re: Splitting on =

2005-09-21 Thread Jeff &#x27;japhy&#x27; Pinyan
this a bug. 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

Re: Package require question again

2005-09-19 Thread Jeff &#x27;japhy&#x27; 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 dou

Re: Package require question again

2005-09-19 Thread Jeff &#x27;japhy&#x27; Pinyan
to every data 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} . "::"}{Optio

Re: How to Update Hash to Itself Recursively

2005-09-16 Thread Jeff &#x27;japhy&#x27; Pinyan
hash for @result instead of the array like I did. -- 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/ %-- Meist

Re: keys of hash of hashes

2005-09-16 Thread Jeff &#x27;japhy&#x27; Pinyan
%hash', 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

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

2005-09-15 Thread Jeff &#x27;japhy&#x27; Pinyan
r/bin/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

Re: strange result with reg exp

2005-09-14 Thread Jeff &#x27;japhy&#x27; Pinyan
string to uppercase. perldoc -f uc -- 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: Why wont this work? Package require question

2005-09-14 Thread Jeff &#x27;japhy&#x27; Pinyan
b, a reference to every type (scalar, 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://p

Re: Why wont this work? Package require question

2005-09-14 Thread Jeff &#x27;japhy&#x27; Pinyan
pl"; # loading, for example, Inn.pl Now you want to call the Inn::HTML() function, right? You can't easily do it if strict is turned on. Here's one way, though: my $glob = $main::{$Player{Location} . "::"}{HTML}; $glob->(); -- Jeff "japhy" Pinyan

  1   2   3   4   5   6   7   8   9   10   >