using GET and parsing content.

2001-05-21 Thread Jeff
open(DOM, GET 'http://URL') || "unable to open website\n"; The GET here doesn't actually get the results it just dumps the main URL not the results. The URL is http://http://www.whitepages.com/find_person_results.pl?fid=n&f=&ft=b&l=$name<=b&c=&s=&x=45&y=10 I get stuck here...any pointers? Thanks Jeff

How can I send an HTML format email using send mail

2001-12-17 Thread jeff
lp is greatly appreciated. Jeff -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Automatic execute of script

2001-12-28 Thread jeff
Does anyone know how to get a script to execute at a predefined time without user interaction. I would like to monitor my sys clock and have the perl script execute. Thanks Jeff -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Automatic execute of script

2001-12-28 Thread jeff
Our business hosting service does not allow cron, they recommend checking with a third party. I write the scripts on a windows machine and upload them to the apache Unix server to test and execute them. Do you know of any perl modules that self execute? -Original Message- From: Jeff

RE: Good CS Literature

2001-12-29 Thread jeff
re would like to fall to sleep skimming through perldoc. Jeff -Original Message- From: Michael R. Wolf [mailto:[EMAIL PROTECTED]] Sent: Saturday, December 29, 2001 12:35 AM To: [EMAIL PROTECTED] Subject: Re: Good CS Literature Luke <[EMAIL PROTECTED]> writes: > I bought t

RE: Automatic execute of script

2001-12-29 Thread jeff
aintenance. I think this would stop execution of the script. The cron is not allowed by our business host account and autosys costs money. I am still investigating the AT command. Thanks again!! Jeff -Original Message- From: Chris Spurgeon [mailto:[EMAIL PROTECTED]] Sent: Friday, D

perl to flash

2010-01-08 Thread jeff
read back into perl script. Would like to hear from anybody that has done this or can direct me to a solution. Best Regards, Jeff Zanzinger RealEstateCE.com ph: 888.895.8839 fax: 866.517.1406 <http://RealEstateCE.com/> http://RealEstateCE.com/ <>

Perl Script mirroring accross domains

2008-09-19 Thread jeff
nance nightmare in configuration control. I'm looking for a solution where I don't have to run and maintain 2 copies of the same scripts to support 2 separate and independent domains. Any help is greatly appreciated. Best Regards, Jeff Zanzinger RealEstateCE.com ph: 888.895.8839 fax

problems implementing SOAP::WSLD service.

2011-10-28 Thread jeff
/envelope/";>soap:Server< /faultcode>Server was unable to process request. ---> Authentica tion Failed Best Regards, Jeff Zanzinger RealEstateCE.com ph:  888.895.8839 fax:  866.517.1406 http://RealEstateCE.com/  -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

use Win32::Internet unix equivalent function?

2002-05-02 Thread Jeff
Anyone know of a unix equivalent to win 32 function Win32::Internet Trying to capture a web page as a string i.e. $INET = new Win32::Internet(); $file = $INET->FetchURL("http://www.yahoo.com";;); Thanks, Jeff -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com

Conditional in regex

2007-06-23 Thread Jeff
Hi all. I'm new to perl, a new programmer, and I badly need guidance. I'm trying to parse a config file with key/value pairs seperated by white space and surrounded by curly brackets. It has multiple fields that look like this: { Key value Key value } My solution has been to parse it with som

Re: Conditional in regex

2007-06-24 Thread Jeff
On 6/24/07 10:42 AM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > You don't need to repeat the pattern by hand - the /g will do that for > you. > Thanks to everyone for the replies. I expected what you pointed out above, that /\b(w+)\s+(\w+)\s+/gs would match every instance of the patte

Comparing numbers

2007-09-09 Thread Jeff
This is a true beginner's question, so bear with me. I have an array of numbers. Is there a function to tell me which is larger (or smaller?) Also, how do I search with perldoc for a function when I don't know the name? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mai

Re: Comparing numbers

2007-09-10 Thread Jeff
On 9/9/07 1:54 PM, "Douglas Hunter" <[EMAIL PROTECTED]> wrote: > Jeff wrote: >> This is a true beginner's question, so bear with me. I have an array of >> numbers. Is there a function to tell me which is larger (or smaller?) > > > Sure. Perl'

Re: stop

2004-01-07 Thread jeff
you could always change your email address!  Just a thought. - Original Message - From: David Kapp To: [EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 14:31 Subject: stop

Re: Killing Idle Users

2002-06-11 Thread Jeff
Why can't you just put export TMOUT=3600 readonly TMOUT in /etc/profile ? If it doesn't work, contact the vendor (IBM for AIX) for a patch. --- "Akens, Anthony" <[EMAIL PROTECTED]> wrote: > Hello, > I'm a sys-admin on an AIX (4.3) machine, and I'm trying to work > with a vendor progra

Use vs Require

2002-07-11 Thread Jeff
I'm new to perl, but have a background in C. Can someone tell me what is the difference between 'use' and 'require'? When do you use one and not the other? Seems they both are comparable to a C header file (.h). Thank

Flat File Db

2002-07-17 Thread Jeff
t why this happens. Thanks for any help! Jeff -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Flat File Db

2002-07-17 Thread Jeff
t;; } -Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 8:11 PM To: [EMAIL PROTECTED] Subject: Re: Flat File Db Jeff wrote: > > I'm use flat files to manage a list containing approx 25,000 records. For > updates, I write to a temp

Re: Cron and Perl Script

2002-07-26 Thread Jeff
I've never seen this syntax before: */5(from line: */5 * * * * root perl /home/sites/sa/cgi-bin/test.pl) Is that legal?! -J --- "Mike(mickako)Blezien" <[EMAIL PROTECTED]> wrote: > Remove the "root per" form the command line > > Max Hugen wrote: > > > > I have a simple perl script whic

RE: file exists statement

2002-09-08 Thread Jeff
unless -e '/dir/path/file'; -or- if ( not -e '/dir/path/file' ) { } -Original Message- From: Tony [mailto:[EMAIL PROTECTED]] Sent: 08 September 2002 10:24 To: [EMAIL PROTECTED] Subject: file exists statement I keeps writing this out if (-e "/dir/path/file"){}else{ #execute } To

Mod Installations -- as non root

2002-09-12 Thread Jeff
don't see the answer to this. Thanks in advance, Jeff __ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: sorting a hash - multiple key fields

2002-09-17 Thread Jeff
and getting it to lookup the child-hash - it seems to me it would be way more efficient to pass in the hash values and not bother with the lookup? Thanks for the feedback, Regards Jeff -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: lots of numbers...

2002-09-18 Thread Jeff
-Original Message- From: Janek Schleicher [mailto:[EMAIL PROTECTED]] Sent: 18 September 2002 18:32 To: [EMAIL PROTECTED] Subject: RE: lots of numbers... > You meant my $iterations = int( scalar @numbers / 3 ); > (However, the scalar cast isn't necessary) > > my $iterations = int(@numb

passing a variable to a module

2002-10-15 Thread jeff
THINGS I'VE TRIED END Executive summary: how do I define a variable in my program and have a module use that variable definition (in a non-oo module). Jeff -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

problem saving binary data

2001-06-07 Thread Jeff Davis
(sorry 'bout the duplicate - bad data) I'm using LWP to fetch an image and attempting to save it locally. The file is successfully created, however all it contains is: HTTP::Response=HASH(0x8380464) Here's the code snippet: $file = "/home/images/$name"; open(IMAGE, ">$file") || die "unabl

Re: Gurus Wanted!!

2001-06-08 Thread Jeff Yoak
things like other values for -type (like 'd' for directory), other switches (like -name... modify the above to catch files ending in .html with -name "*.html") and -exec and more. Enjoy! Cheers, Jeff

Re: Doubt in understanding

2001-06-08 Thread Jeff Yoak
At 02:16 PM 6/8/01 +0530, Rajanikanth Dandamudi wrote: >Hello, > > I had a problem understanding what the >expression ${1+"$@"} mean? can someone help me in >understanding this? That's bizarre. In what context did you encounter it? Cheers, Jeff

Re: C++ in perl.

2001-06-08 Thread Jeff Yoak
talk about Inline.pm . You might look into it. Cheers, Jeff

Re: Understanding Randal's answer

2001-06-08 Thread Jeff Yoak
" operator. I don't have the original post on this computer, but I remember it vaguely. Could it be simply modified to use -print0 and xargs -0 to get the desired result? cheers, Jeff

Re: if then else

2001-06-08 Thread Jeff Yoak
r catch it for you. And damn all languages that use '=' for comparison. I end up with this error creeping into code after I've spent too much time on SQL. Cheers, Jeff >## >##set $previous site var. >## >if ($ENV{'HTTP_REFER

Re: Matching one array against another

2001-06-08 Thread Jeff Yoak
e about, will all be undef. my %list; @list{qw(item whatever baz bar)} = (); Now to get the same thing as above, you can ask more directly like this: foreach my $item (keys %possible_matches){ if(exists $list{$item}){ # do whatever } } or more succinctly: my @matches = grep {exists $list{$_}} keys %possible_matches; Enjoy! Cheers, Jeff

Re: Understanding Randal's answer

2001-06-08 Thread Jeff Yoak
rnate regardless? It's not just you. :-) Cheers, Jeff

Re: Matching one array against another

2001-06-08 Thread Jeff Yoak
P.S. Using hashes will eliminate duplicate entries from both lists. My assumption in suggesting this was that that wasn't a problem, but it is something that should be made explicit. Cheers, Jeff At 03:24 PM 6/8/01 -0700, Jeff Yoak wrote: >Code to do what you are looking for is

Re: if then else

2001-06-09 Thread Jeff Yoak
thing is that I wrote that during a short break from writing important code. I wonder what sort of nasties lie waiting... Cheers, Jeff

Re: Understanding Randal's answer

2001-06-09 Thread Jeff Yoak
At 07:10 AM 6/9/01 -0700, Randal L. Schwartz wrote: > >>>>> "Jeff" == Jeff Yoak <[EMAIL PROTECTED]> writes: > >Jeff> At 05:11 PM 6/8/01 -0500, Karen Cravens wrote: > >> On 8 Jun 2001, at 14:33, Randal L. Schwartz wrote: > >> > >&

Perl FAQ A Day

2001-06-11 Thread Jeff Yoak
. http://perl.faq-by-day.org/ . Cheers, Jeff

Re: Perl FAQ A Day

2001-06-11 Thread Jeff Yoak
27;t really done much. But that doesn't stop me from promoting it or a lot of people from seeming to find it useful. ;-) But thank you for the compliment. I'm glad to hear it is useful to you. Cheers, Jeff

Re: Perl FAQ A Day

2001-06-11 Thread Jeff Yoak
the biggest values in the Perl FAQ is that it is so extraordinarily well-written and precise. Many of the web collections I've seen in the past contain a lot of mistakes and misinformation and I would feel bad about including something like that unknowingly. Cheers, Jeff

Re: Matching '@' symbol in regexp

2001-06-11 Thread Jeff Yoak
At 06:24 PM 6/11/01 -0400, Jeff 'japhy' Pinyan wrote: > >Can anybody suggest me how to match '@' symbol in a regexp to match e-mail > >ids etc. > >I suggest you don't try to write your own email-matching regex. But just >because you asked, use

Re: Perl FAQ A Day

2001-06-11 Thread Jeff Yoak
to me unread. Ironically, four years later he wrote to me asking why I hadn't considered hosting the list at perl.com, which would have required contacting him.) >Some of these may appear in the Perl Tips list in the coming months. Cool. What's that? Cheers, Jeff

Re: testing on email characters

2001-06-13 Thread Jeff Yoak
omeone should point out that the proposed problem isn't solved in any of these ways. In another post, I mentioned Email::Valid and some other conversation about ways to do it. Cheers, Jeff

RE: testing on email characters

2001-06-14 Thread Jeff Yoak
>that wouldn't be caught and put other mechanisms in place to handle those. It claims to implement the RFC "except for nested comments." Cheers, Jeff

Re: Perl Style Question

2001-06-26 Thread Jeff Yoak
the opening brace in if and loop statements. That breaks $y% or just $%. They still haven't found his body and all of his code has been repaired. Cheers, Jeff

Re: Repost: Script won't exec

2001-07-17 Thread Jeff Yoak
It looks like you have a ')' where you want a '}' there. Cheers, Jeff At 03:17 PM 7/17/01 -0600, Customer Service wrote: >Syntax error near $ENV{'REQUEST_METHOD') >…Aborted due to compilation errors > > Script follows: >#!c:/perl/bin/

"echo verbose" equiv. in perl?

2001-08-13 Thread Jeff Friesen
ending the output into a file for later reviewing (in case something went wrong with a script run on cron). I have found no documentation for it, and I searched CPAN to no avail. ? -Jeff -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Net::FTP question

2001-08-24 Thread Jeff A
I need to pick up a file from an ftp server of the format MMDD.txt. How can I pick up the file if the file name is different each time the program would connect to the server? What type of expression could I use to get the file? Jeff -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Net::FTP question

2001-08-27 Thread Jeff A
I've actually tried that but when I do dir() or ls() I get the LIST command 125 Data Connection already open; No listing appears on the screen although I know that there are files in the driectory. Jeff Bob Showalter wrote: >> -Original Message- >> From: Jeff

Re: appending unique entries to a text file in perl

2001-05-04 Thread Jeff Pinyan
e done. Close up shop. close SRC; close DEST; If you're interested in seeing how you might write this code later in your Perl career, as you learn idioms and such, I offer: my %seen; open IN, $in or die "can't read $in: $!"; open OUT, "+< $out" or die &quo

Re: Counting lines on a file

2001-05-04 Thread Jeff Pinyan
sysread FILE, $buffer, 4096) { $lines += ($buffer =~ tr/\n//); } close FILE; This assumes no funny games with newline translations. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.

Re: Counting lines on a file

2001-05-04 Thread Jeff Pinyan
er of the most recently read line. 1 while ; print $.; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/

Re: Counting lines on a file

2001-05-05 Thread Jeff Pinyan
her wasteful use is: @lines = ; for (@lines) { ... } when a simple: while () { ... } will do. I have an article about files and filehandling on my web site: http://www.pobox.com/~japhy/articles/pa/2000-01.html -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pob

Re: generating passwords

2001-05-05 Thread Jeff Pinyan
$x such that $a <= $x < $b+1 And when we take the integer value of this value, it will be $a <= $x <= $b So there we are. Now for our function. sub randBound { my ($lower, $upper) = @_; return int( rand($upper + 1 - $lower) + $lower ); } -- Jeff "japhy"

Re: nested each(%hash) question

2001-05-05 Thread Jeff Pinyan
;& $time < $_->[1]); # last if the time is too small for the rest of the ranges last if $time < $_->[0]; } } -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://foru

Re: generating passwords

2001-05-05 Thread Jeff Pinyan
rand 2) { $string .= int rand 10; } else { $string .= $letters[rand 26]; } -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc.

Re: Regex "([^"]*)

2001-05-06 Thread Jeff Pinyan
called 'explain') to get an explanation of your regex, which should help you see why it's failing. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734

Re: Regex "([^"]*)

2001-05-06 Thread Jeff Pinyan
On May 6, Jeff Pinyan said: >On May 7, Clinton said: > >>I'm tring to extract some values delimited by quotes >>I can extract the first set using "([^"]*) but not the second set using >>"([^"]*),"([^"]*). Could I have a clue please? &

Re: regexp trouble

2001-05-07 Thread Jeff Pinyan
-- _'_' -- )end of grouping -- == -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.p

Re: regexp trouble

2001-05-07 Thread Jeff Pinyan
lso using \2 on the right-hand side (RHS) of a s///, which is not safe. You should use $2. s/^[A-Za-z]+_//; does far less work. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl P

Re: More hash trouble

2001-05-07 Thread Jeff Pinyan
t also consider using regex objects instead of quoted strings. %fields = ( s => qr/([0-5]\d)/, m => qr/([0-5]\d)/, h => qr/([01]\d|2[0-3])/, ); $fields{t} = qr/$fields{h}:$fields{$m}:$fields{s}/; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www

Re: More hash trouble

2001-05-07 Thread Jeff Pinyan
me ABC/; Here, $abcXYZ is rendered as (?-ismx:(?-ismx:Mon|Tue|Wed|Thu|Fri|Sat|Sun) ABC) Perhaps it's a bit more noise, but that's how the regexes are formed. Note the (?:...)s. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk?

Re: More hash trouble

2001-05-07 Thread Jeff Pinyan
that work is made somewhat simpler (backslash-wise, at least) with the qr// operator. Also, I'm glad to report I'm constructing an outline for a Perl regular expressions book. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://ww

Re: UNTIE () ERROR

2001-05-07 Thread Jeff Pinyan
. > 316 sub close_db > 317 { > 318 my ($dbref) = @_; > 319 > 320 untie(\%$dbref); > 321 } Change line 320 to: untie(%$dbref); -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com

Re: regexp?? Reading in multiple lines to search??

2001-05-08 Thread Jeff Pinyan
l $/ = "\n!\n"; # so that $/ gets its normal value afterward while () { # do something with $_ } } You might want to know about the /m modifier for regexes, which makes ^ and $ not match beginning and end of a STRING, but rather, beginning and end of a \n-line.

Re: what's wrong in systax

2001-05-08 Thread Jeff Pinyan
essage. My guess is that there are characters in $LOCTAG and $TYPETAG that Perl is using as regex characters. Try: if (/\Q$LOCTAG\E/i) { ... } if (/\Q$TYPETAG\E/i) { ... } instead. Or, consider using index() instead: if (index(lc, lc($LOCTAG)) > -1) { ... } -- Jeff "japhy" Piny

Re: what's wrong in systax

2001-05-08 Thread Jeff Pinyan
F); >> 34 $location =~ s/::$//; >> 35 $jobtype =~ s/::$//; > >Lines 24, 29; perhaps you mean "=~" ? No. Doing: ($foo) = /pattern/; is the same as: ($foo) = $_ =~ /pattern/; What he's doing is getting the ()'d part of the regex, and storing i

Re: mv'ing a file from within perl (w/out /bin/mv)

2001-05-09 Thread Jeff Pinyan
ame fs. If the standard rename() function isn't good enough, File::Copy also has a move() function. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at Ri

Re: Very beginner question

2001-05-09 Thread Jeff Pinyan
hile () { my ($name) = /^\(\w+ = (\w+)\)$/; print "got: $name\n"; } That regex matches the (, and then some "word", then " = ", and then saves the next "word" it finds. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.p

RE: RE: Help with Perl (fwd)

2001-05-09 Thread Jeff Pinyan
To get that to work, you'd need to backslash the quoting character: "he said \"hi\" to me" qq/he said \/hi\/ to me/ but that should be a sign that you should've chosen a different character. Using qq(), qq[], qq{}, or qq<> allows you to nest the quotes

RE: @INC

2001-05-09 Thread Jeff Pinyan
it for EVERYTHING unless you recompile Perl. You can do it for yourself all the time by setting the PERL5LIB environment variable to a colon-separated list of directories to add to @INC automatically. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a

Re: New to Perl

2001-05-10 Thread Jeff Pinyan
p://www.pobox.com/~japhy/docs/LPRE.html -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Aca

RE: New to Perl

2001-05-10 Thread Jeff Pinyan
ion of that book, and it is *four* years old. A lot has changed for Perl's regexes in that time. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at R

Re: New to Perl

2001-05-10 Thread Jeff Pinyan
On May 10, Peter Scott said: >At 09:29 AM 5/10/2001 -0400, Kevin Meltzer wrote: >>On Thu, May 10, 2001 at 09:17:30AM -0400, Jeff Pinyan ([EMAIL PROTECTED]) >>spew-ed forth: >> > On May 10, Crandell, Daniel (TIFPC) said: >> > >> > >Same situation he

Re: Taint flag

2001-05-10 Thread Jeff Pinyan
ted. Just curious if anyone >knows what this means. Please check the perldiag documentation, which explains this warning. You must send -T on the command-line, because by the time Perl actually starts RUNNING your program, it's too late to do some of the taint checking it should have done.

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Jeff Pinyan
x27;tr/\r//d' files... Why use Perl if you don't have to? japhy% tr -d '\r' < file > file.new; mv file.new file -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.pe

Re: hex conversion

2001-05-10 Thread Jeff Pinyan
. Sadly, the oct() and hex() functions are poorly named; they should be from_oct() and from_hex(). You want to use sprintf(). $as_hex = sprintf "%x", $num; $as_hex = sprintf "%#x", $num; # adds a leading "0x" -- Jeff "japhy" Pinyan [EMAIL PR

Re: hex conversion

2001-05-10 Thread Jeff Pinyan
On May 10, Paul Cotter said: >print dtcnvx('Ab c') # gives 41622063 Ohh. Oops. $x = unpack 'H*', 'Ab c'; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/

RE: Sorting

2001-05-10 Thread Jeff Pinyan
= $b =~ /\@([^:]+)/ if not exists $cache{$b}; $cache{$a} cmp $cache{$b} } @orig; You can read about these two at: http://www.pobox.com/~japhy/docs/sorting.html -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734

RE: Sorting

2001-05-10 Thread Jeff Pinyan
On May 10, Jeff Pinyan said: > { >my %cache; >@new = sort { > ($cache{$a}) = $a =~ /\@([^:]+)/ if not exists $cache{$a}; > ($cache{$b}) = $b =~ /\@([^:]+)/ if not exists $cache{$b}; > $cache{$a} cmp $cache{$b} > } @orig; } -- Jeff "

RE: Sorting

2001-05-10 Thread Jeff Pinyan
On May 10, Peter Scott said: >At 05:55 PM 5/10/01 -0400, Jeff Pinyan wrote: >>That sorting method does a lot of work -- that is, it does things more >>than once. I suggest you use a schwarztian transform, or the Orcish >>manuever, to increase speed. > >I'd lik

[OT] Origin of "Orcish Maneuver"

2001-05-11 Thread Jeff Pinyan
name always helps me remember things like that. Thanks. Joseph Hall (author of "Effective Perl Programming") coined the term "Orcish maneuver", because in essence, it's supposed to look like: $cache{$a} ||= function($a); $cache{$b} ||= function($b); So it's "OR&quo

Re: Regexp Question Again

2001-05-11 Thread Jeff Pinyan
\)? ')' (optional (matching the most amount possible)) -- )end of grouping -- -- Jeff

Re: Help With Matching

2001-05-11 Thread Jeff Pinyan
On May 11, FLAHERTY, JIM-CONT said: >$test1 = s/<>//g ^ This gives an error. s!<>!!g; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl

Re: problems with CGI script

2001-05-12 Thread Jeff Pinyan
# not BDSM_File ;) use Fcntl; # for O_CREAT and O_RDWR constants tie my(%db), SDBM_File => ( $filename, O_CREAT | O_RDWR, # file flags 0666, # permissions ) or die "can't tie to $filename: $!"; for my $key ($cgi->param) { $db{$key

Re: Sorting a file

2001-05-13 Thread Jeff Pinyan
le to 0 bytes truncate FILE, 0; # spit information out in readable form for (sort keys %records) { print FILE "#$_\n", @{ $records{$_} }, "\n"; } close FILE; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk?

Re: Sorting a file

2001-05-13 Thread Jeff Pinyan
On May 13, Jeff Pinyan said: >if (/(?:^|\@)(\S+)/) { I had a precedence error in my code here. That regex will match at the beginning of the line every time. It should be: if (/\@(\S+)/ or /(\S+)/) { # ... } Sigh. And I'm writing a book about these. I should ge

Re: Sorting a file

2001-05-14 Thread Jeff Pinyan
. I had originally had two regexes, and then I concatenated them, terribly incorrectly. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Gr

Re: flock

2001-05-14 Thread Jeff Pinyan
use mkdir() and rmdir(). Although it requires you to create a lock file, it's atomic and safe. sub lock { 1 until mkdir "$_[0].lck", 0777; $locked{$_[0]}++; } sub unlock { rmdir "$_[0].lck"; delete $locked{$_[0]}; } END { rmdir "$_.lck" f

Re: flock

2001-05-14 Thread Jeff Pinyan
On May 14, Peter Scott said: >Ooh, that is clever. Has it been encapsulated in a CPAN module? No. It can break on NFS. >> 1 until mkdir "$_[0].lck", 0777; > >Perhaps sleep 1 until mkdir would be a little less stressful on the average >system :-) Feh.

RE: flock

2001-05-14 Thread Jeff Pinyan
#x27;re on an NFS, all bets are off. The Perl Cookbook mentions the mkdir+rmdir locking scheme. I think that's a pretty safe bet. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlgu

Re: negative matching?

2001-05-14 Thread Jeff Pinyan
_alt($1)/eg; sub add_alt { my $tag = shift; substr($tag, -1, 0, ' alt="FOO!"'); # insert alt attr. return $tag; } -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734

RE: Perplexing problem.........probably beginners luck??

2001-05-15 Thread Jeff Pinyan
while (defined($x = )) { '???'; } while ($x and ) { '???'; } while ($x and $y = ) { '???'; } Those last two can't be optimized to a simple assignment from , so Perl doesn't do its magical change. -- Jeff "japhy" Pinyan

Re: formatting

2001-05-15 Thread Jeff Pinyan
the most amount possible)) -- )end of \1 -- )end of grouping ------

Re: Sorting a Two Dimensional Array

2001-05-16 Thread Jeff Pinyan
has a non-false value, else '' > $a || $b # returns $a if nonfalse, else $b if nonfalse, else '' That is misinformation. #!/usr/bin/perl -l print (10 || 100); print (10 or 100); __END__ 10 10 -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http

Re: special variables

2001-05-16 Thread Jeff Pinyan
atched in nested blocks that have been exited already. (Mnemonic: like \digits.) These variables are all read-only. Example: if ($line =~ /^(\w+)\s*=\s*(.*)/) { print "setting '$1' to '$2'\n"; $config{$1} = $2; } -- Jeff

Re: Array Question

2001-05-16 Thread Jeff Pinyan
nd in /usr/local/lib/perl5/5.6.0/pod/perlfaq4.pod How can I remove duplicate elements from a list or array? -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at Ris

Re: Variable Creation

2001-05-17 Thread Jeff Pinyan
ULD have used for variables. ($variable) = getNextRule(); $data{$variable} = [ ... ]; # create an anonymous array Now, instead of looking at @$variable, look at @{ $data{$variable} }. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/

[ADV] Symbol Table (was Re: Variable Creation)

2001-05-17 Thread Jeff Pinyan
that holds references to $foo, @foo, %foo, and &foo (and a bit more). You can treat a typeglob as ANY sort of reference! So... - if $SymbolTable::{$name} returns a typeglob... - and a typeglob can be dereferenced to anything... - then ${ $SymbolTable::{$name} } is like... - $SymbolTable

Re: Compare statement.

2001-05-17 Thread Jeff Pinyan
a no-no. You need to use 'eq'.) You might think it's overkill, but I might use a hash if there are a lot of values. my %valid_x; @valid_x{'a', 'test', 'return', 'x-return'} = (); if (exists $valid_x{$x}) { # ... } -- Jeff "japh

Re: String concatenation in ?: structure.

2001-05-17 Thread Jeff Pinyan
$subject .= ($ret eq 'o.k.' ? " -OK- " : " -FAILED- "); $subject .= (" -FAILED- ", " -OK- ")[$ret eq 'o.k.']; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/

  1   2   3   4   5   6   7   8   9   10   >