RE: Does perl hava free edition for AIX, Solaris?

2013-03-18 Thread Lancashire, Pete
fault, and the default perl that comes with AIX has very few modules. This can cause issues if you try to build the bigger or more conplex modules such as DBI. -pete -Original Message- From: rjc [mailto:r...@linuxstuff.pl] Sent: Monday, March 18, 2013 12:09 PM To: beginners@per

FH as a value from a list

2012-03-05 Thread Lancashire, Pete
my brain this morning is blocked on this one I have a file something like cpu01 value value value cpu02 value value value cpu03 value value value ... cpu01 value value value cpu02 value value value cpu03 value value value ... cpu01 value value value cpu02 value value value cpu03 value va

Making HTML::WikiConverter for MWimporter on Win64

2011-09-22 Thread Pete
help on my next steps would be very much appreciated! Pete

Re: [use DBI] - how to improve security in perl script (

2011-05-18 Thread Pete Smith
password in a configuration file (and use something like Config::General to load it) which is only readable by a secured user. You can then setuid [1] the script to execute as that user - however, take note of any security issues this might infer. Cheers, Pete [1] http://en.wikipedia.org/wiki

Re: sendmail in perl

2011-05-12 Thread Pete Smith
I imagine there are going to be many recommendations - and there are always new, "better" modules coming out for this sort of thing. However, I'll kick things off to say I've used MIME::Lite [1] for a long time and it has always done everything I've needed.

Re: Rounding Date/Time

2011-05-05 Thread Pete Smith
way? The Modern Perl suggestion when dealing with dates and times is to use DateTime. It is well tested and should handle edge cases you may not have considered. After all, what do you do when you want to round up from 2011-12-24 23:58:00? You can use Math::Round to do the rounding for you. Ch

Re: unable to set cookie when using template toolkit

2011-05-04 Thread Pete Smith
. You need to send the header in all cases. Try changing your if block to: if ( $evalue == 3 ) { my $cookie = $cgi->cookie(CGISESSID => $session->id); print $cgi->header( -cookie=>$cookie ); deploy_page(); } else { print $cgi->header; } Pete The $cgi-&g

Re: unable to set cookie when using template toolkit

2011-05-04 Thread Pete Smith
ader without the cookie depending on the behaviour you want. Cheers, Pete On 04/05/11 14:23, Agnello George wrote: Hi In my script i am using template toolkit. I am trying to set the cookie in my browser but all that it does is it prints the following output on my broswer : Set-C

Help with XML::Twig

2006-02-05 Thread Pete Hicks
Hi, I was wondering if someone could point me in the right direction. In my example below, I have a handler that will parse a contact's name into another xml node. However, the problem is that when I do this, the parent node loses an attribute that I am trying to set. Here is example output: [EM

Re: System call for openssl

2005-11-10 Thread Pete Emerson
x27;$command') is not the same as with double quotes, i.e. system("$command"). With single quotes the $command won't be interpreted. You need double quotes in this case in order for the date command to be successfully executed. Pete On Nov 10, 2005, at 9:32 AM, <[EMAIL

threading stability concerns

2005-11-09 Thread Pete Emerson
vice, personal anecdotes, or online references, pro or con, would be greatly appreciated. Thanks. Pete -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

code so far Re: Converting a 'unique' floating point number into a defult FP variable.

2005-04-15 Thread Pete Lancashire
)/; print "$1 $2 $3 $4 $5 $6 $7 $8\n"; $ieeedouble =~ /(.)(.{11})(.{52})/; print "IEEEDBL SIGN:$1 EXP:$2 MANT:$3\n"; print "5 " . "-" x 50 . "\n"; # looks ok to me $one = pack "B64", $ieeedouble; # print $one; # od -t x1 40 04 00 00 00 00 00

Converting a 'unique' floating point number into a defult FP variable.

2005-04-15 Thread Pete Lancashire
8| |23 16| |___|___| |___|___| |___|___| |M|M|M|M|M|M|M|M| |E|E|M|M|M|M|M|M| |S|E|E|E|E|E|E|E| Least Sig. Byte Most Sig. Byte Sign 1 bit Exp 9 bits Mantissa 14 bits 00 60 c0 = -3.5 00 00 40 = 2.0 00 40 40 = 3.0 00 60 40

Need help to calculate average value in hash

2004-10-19 Thread Pete Tong
Hi All, I have file: PHI: 15 CA: 32 NY: 14 PHI: 35 NY: 11 CA: 22 NY: 23 CA: 36 I need to put it into hash. Key – State, Value – Number (Average Value!!!) So in output I should have: PHI:25 CA:30 NY:16 - Do you Yahoo!? Yahoo! M

Re: env vars using perl

2003-09-25 Thread Pete Emerson
Asif Iqbal wrote: I can use this to get all the env variables ... Now how can I use this trick to get all the web env variables ? I am using apache on unix (solaris 8) ? It's the same way. Here's code that works for me: #!/usr/bin/perl -w use strict; use CGI qw(:standard); print header; print st

PDF content extraction

2003-09-25 Thread Pete Emerson
I can go native, so much the better. Thanks. Pete -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Rename files script - a first effort

2003-07-10 Thread Pete Emerson
John W. Krahn wrote: Just a couple of comments if you don't mind. (I knew you wouldn't :-) Of course not, that's how I keep on learning! :) Due to way some file systems work I would store the file names in an array and use the array to rename the files instead of renaming them in the File::Fi

Re: Rename files script - a first effort

2003-07-10 Thread Pete Emerson
even a loss, perhaps, I don't know, but probably not worth caring about if there is one. Pete #!/usr/bin/perl -w use strict; use File::Find; my $dir=$ARGV[0]; $dir='.' if (!defined $dir); die "$dir is not a valid directory." if (!-d $dir); $dir=~s#/$##; find(\&Rename, $

Re: make errors with RPM::Database on redhat 9.0

2003-06-02 Thread Pete Emerson
ecture being the one I was particularly missing). There have been other packages that have not installed for me under RH9. Mail::SpamAssassin and HTML::Parser being two. I installed perl from source, and that helped, although I still had to force install HTML::Parser. Pete -- http://emerson.

Re: HASH PRINTING

2003-04-03 Thread Pete Emerson
3pm from Eric Walker: EW> I don't know if I am reading the data dumper help code right but it seems you EW> have to provide a list of the hash keys to get the values. I need a way to EW> just print out all keys and values no matter how many levels of hierachy there EW> may be i

Re: $from_address

2003-03-28 Thread Pete Emerson
27;, RS> ); RS> RS> $mail{body} = < RS> First Name: $fname RS> Last Name: $lname RS> Email: $email RS> Organization: $org RS> Scientific Interest: $sci_int RS> Mailing List? $check RS> RS> sendmail(%mail) || print "Error: $Mail::Sendmail::error\n"; RS> RS> RS> -- http://emerson.wss.yale.edu/perl Pete Emerson WSS AM&T Yale University -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Statement execution...

2003-03-27 Thread Pete Emerson
Here you go, and your guess as to what prints out is right on; subroutines don't run until they're called, and placement in this situation doesn't affect anything. #!/usr/bin/perl -w use strict; print "one\n"; sub aa { print "two\n"; } print "three\n"; print "four\n"; sub bb { prin

Re: Filling out forms on the web.

2003-03-20 Thread Pete Emerson
not associated with Randal or Linux Magazine in any way, other than being a subscriber. :) Pete Mar 20, 2003 at 10:38am from Larry Wissink: LW> been able to do comes from reading "Perl & LWP" by Sean M. Burke (O'Reilly LW> Press). LW> I include what I have managed to w

Re: Evaluating parts of a string

2003-03-18 Thread Pete Emerson
ar eq '$fileName'; $string=eval($var); Pete Mar 18, 2003 at 11:26am from Navid M.: NM> Thanks Pete, I actually thought about this, but NM> because of the format of my perl script, it'll get too NM> messy if I do this with a regex. The thing is, If I NM> didn't have any

Re: Evaluating parts of a string

2003-03-18 Thread Pete Emerson
is coming from your first perl script. my $filename='filename.txt'; $string=~s/\$filename/$filename/; # Regex! Escape the $ ... print "$string\n"; Pete -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Fun with Regexes

2003-03-17 Thread Pete Emerson
t;Can't open $file: $!" if (!open INFILE, $file); or is this a different kettle of fish? By the way, I really appreciate that this list caters to multiple levels of "beginners"! I've not only been helped a lot on here, but I hope I've helped a few myself. :) -- http://

Re: Fun with Regexes

2003-03-16 Thread Pete Emerson
Thanks for your code, I've gotta look up \Q to make sure I understand what's happening, but it looks great. I'm still parsing your comments to make sure I understand everything. I'm not quite sure what you meant about side effects from my conditional being frowned upon...how else do you use the ()

Fun with Regexes

2003-03-15 Thread Pete Emerson
(@strings) { my $success=1; foreach my $match (@matches) { ($string=~/$match/) ? (next) : ($success=0); last; } ($success) ? (print "$string matches.\n") : (print "$string does not match.\n"); } Pete -- http://emerson.wss.yale.edu/perl Pete Em

Re: apache error

2003-03-14 Thread Pete Emerson
er; print start_html; print "Hello world!\n"; print end_html; Mar 14, 2003 at 8:16am from Francesco del Vecchio: FdV> [Fri Mar 14 17:03:11 2003] [error] [client 127.0.0.1] Premature end of script headers: hello.pl -- http://emerson.wss.yale.edu/perl Pete Emerson WSS AM&T Yale U

Re: getting the number of characters

2003-03-12 Thread Pete Emerson
The length() function is what you need. print length($num), "\n"; Mar 12, 2003 at 10:08am from David Gilden: DG> I am looking for the $num to treated as a string and get the number of characters, -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: return a regex substitution in one line

2003-03-11 Thread Pete Emerson
this if-then-else approach. I'd vote for keeping it the way you've done it; I don't think you'll gain anything by having it on just one line, unless it's just _satisfying_ to have it that way! Pete -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Search and Replace

2003-03-11 Thread Pete Emerson
Jay, Here's my solution. It doesn't use File::Slurp, as Dan suggested, but it does what you want it to do. I think that David's point is a good one ... if you don't need to preserve order, you can just use a hash. This method will preserve the order of the second file. P

Re: Main email body

2003-03-08 Thread Pete Emerson
Mail::Audit can do this for you. my $mail=Mail::Audit->new(); my $from=$mail->from; my $to=$mail->to; my $cc=$mail->cc; my $subject=$mail->subject; my $body=$mail->body; Pete On Sat, 8 Mar 2003, Mike Blezien wrote: > Hello All, > > I've sent up a .forward file

Re: Test for empty list

2003-03-07 Thread pete peterson
> } > > > But somehow I think there is a more clever or shorter way. > > Is there? > Can't you use 'scalar grep($_, @test)' and do something like: print scalar grep($_, @test) ? "not " : "", "empty\n" pete peterson -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: trying to match variable names

2003-03-06 Thread Pete Emerson
txt" or die "Can't open OUTFILE: $!"; while () { chomp; ($line=~/ /) ? (print OUTFILE "\"$_\"\n") : (print OUTFILE "$_\n"); } close INFILE; close OUTFILE; Pete On Thu, 6 Mar 2003, Carrara, Greg wrote: > Hello, > I&#

Re: pattern matching problems

2003-03-06 Thread Pete Emerson
On Thu, 2003-03-06 at 09:32, Francesco del Vecchio wrote: > If I have a string as the following: > a xx b a x b > and I try a m/a(.*)b/g > $1 = xx b a x > what have I to do to obtain two matches each of one give me > $1 = x #!/usr/bin/perl -w u

Re: trying to match variable names

2003-03-06 Thread Pete Emerson
%variable3=(1,2,3,4); # |SOMETEXT should NOT get matched open INFILE, $0; while () { while (m#([EMAIL PROTECTED])#g) { print "$1\n"; } } close INFILE; Pete On Thu, 2003-03-06 at 02:35, Daniel Mueller wrote: > i'm currently trying to match all variables in a file, t

Re: Using multiple test statements

2003-02-27 Thread Pete Emerson
unlike /^(joe|dude)$/. In this case, we can do it either way, but we don't need to capture anything in the regex, hence the reason why Stefan put that in. Pete -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Using multiple test statements

2003-02-27 Thread Pete Emerson
#!/usr/bin/perl -w use strict; my @list = qw(fred joe bob john dude eddie rob dudette joeshmoe); foreach (@list) { print "$_\n" if (/joe|dude/); } Note that you'll match on dudette and joeshmoe ... if you want an exact match, you could do: print "$_\n" if (/^joe|dude$/); On Thu, 2003-02-27 a

Re: Shifting

2003-02-25 Thread Pete Emerson
There are probably oodles of ways of doing this. Here are two: # An array slice @[EMAIL PROTECTED]; or # start at position 0, remove 9 elements splice @data, 0, 9; Pete On Tue, 2003-02-25 at 14:39, dan wrote: > onwards. My way of doing this was: > shift(@data); x 9 -- To unsubscr

Re: shlock and retrying

2003-02-20 Thread Pete Emerson
I'm not sure what might be the best way to approach this. I'm not comfy > with an indefinite loop, where if there is some problem removing the lockfile, > my program would wait forever. I'd rather try for a few minutes, then exit > with some error. > > Any pearls of

Re: How to display dir contents on web page?

2003-02-19 Thread Pete Emerson
On Wed, 19 Feb 2003, Scott, Deborah wrote: > Does anyone know where I can get a script that looks into the contents of a > directory and outputs the contents of the directory into a list that is > displayed on an HTML page? (Also, the names should contain hyperlinks to > those contents.) Deborah,

Re: regarding log() function

2003-02-05 Thread Pete Emerson
You probably have the module you need already installed. I did it successfully like this: perl -e 'use Math::Complex; print log(-2.8e-05);' On Wed, 2003-02-05 at 11:41, [EMAIL PROTECTED] wrote: > hi all, > i am using perl 5.8.0 on ix86. i was using an inbuilt function log(). > i am not able to g

Re: sorting hash numerically

2003-02-04 Thread Pete Emerson
perldoc -q sort foreach $empNo (sort {$a<=>$b} keys %empName) { On Tue, 2003-02-04 at 08:17, Rob wrote: > Hi, I want to sort a hash based on the employee number; I used a foreach > loop but it sorts the hash based on the ascii value. How would I get it > to sort on integer values? -- To unsu

Re: Even more regex

2003-01-31 Thread Pete Emerson
Dan, Here's my solution. I'm not capturing the days, hours, minutes, seconds as I go, but I'm sure you can see how to if it's really necessary. #!/usr/bin/perl -w use strict; my @list=('3d4h45m12s', '3h', '5h2m'); foreach (@list) { my $seconds=0; my $string=$_; while ($string=~s/(\

Re: uploading files

2003-01-31 Thread Pete Emerson
Here's a sample. The trick is to turn on autoflushing ($|=1;) so that your text gets printed out right away. #!/usr/bin/perl -w use strict; use CGI qw(:standard); $|=1; print header; print start_html; for (my $i=0; $i<100; $i++) { print "."; sleep 1; } print "\n"; print end_html; On Fri

Re: not getting any result...

2003-01-31 Thread Pete Emerson
The error results of useradd appear to go to STDERR instead of STDOUT. You can redirect them to STDOUT, and therefore capture the results, like this: my $username='username'; my $rescmd=`/usr/sbin/useradd -s /bin/false $username 2>&1`; chomp $rescmd; print "Result is $rescmd\n"; On Fri, 2003-01-3

Re: Hash of Hashes of Arrays?

2003-01-24 Thread Pete Emerson
I'd be tempted to use a hash of hash of hashes, storing it like this: $hash{$city}{$station}{add1}=$address1 $hash{$city}{$station}{add2}=$address2 $hash{$city}{$station}{state}=$state $hash{$city}{$station}{zip}=$zip $hash{$city}{$station}{phone}=$phone So my loop would look like this: foreach my

Re: Only numbers

2003-01-23 Thread Pete Emerson
if ($numexs=~/^\d+$/) { # do this if $numexs contains 1 or more numbers, nothing else } else { } Your regex just checks to make sure there's one number in your entire string. Anchor it at the beginning and the end, and then use a + to say "one or more occurances of" ... if ($numexs=~/^[0-9]+$

Re: cgi and symbolic links

2003-01-23 Thread Pete Emerson
, and the $ENV{SCRIPT_FILNEAME} reflects the fact that it's test2.pl, even though it's a symlink to test.pl You may need that Options line in your section or similar. Pete On Thu, 2003-01-23 at 11:24, Harry Putnam, edited by me for brevity, wrote: > I hoped to have one real cgi

Re: looking for a string in multiple files

2003-01-21 Thread Pete Emerson
> if ($result eq $file1) This is checking to see if each line matches the filename itself, not the contents of file1. You were going for the contents of $file1, correct? Here's my stab. Read in the target files first, then match. When it walks through the source file, it will print out the name

Mail::IMAPClient with SSL

2003-01-18 Thread Pete Emerson
t($_), " messages in ", $_, "\n"; } $imap->close(); and it moans that I'm not connected on the $imap->login() line. Can anyone help me make it go? Thanks in advance. Pete -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Help with merging

2002-12-04 Thread Pete Emerson
$4\n"; print "\$5 --> $5\n"; yields these results: $1 --> ^7Kore^7Adam $2 --> killed $3 --> BEST I TEST $4 --> by $5 --> MOD_MACHINEGUN If "by" is always consistent, it's a bit easier, drop it from the regex altogether: $text=~/^(.*) ($action

Re: Help with merging

2002-12-04 Thread Pete Emerson
How do you determine which pair(s) of words to group together? Are you always grouping items 3 and 4, or might you sometimes want "monkey killed" or "killed elephant" or "with stone" ? There needs to be some way of determining when to pull out a pair and when not to. [EMAIL PROTECTED] wrote: b

Editing text on the CLI

2002-12-04 Thread Pete Emerson
ake line for editable? i.e. right now, line 4 prints out "Edit this", but I can't use the cursor to delete or modify "Edit this". Is there a way to toggle this behavior on and off? Pete -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: GD::Graph::pie -- adding text with GD::Text:Wrap -- How ?

2002-09-25 Thread Lancashire, Pete
That works but I want to add some additional text at the bottom of the image in the bottom margin area. And at times an overlay of text. When I use the function I get "Not a GD::Image object" -pete -Original Message- From: david [mailto:[EMAIL PROTECTED]] Sent: Wednesday, Se

GD::Graph::pie -- adding text with GD::Text:Wrap -- How ?

2002-09-24 Thread Lancashire, Pete
My brain is blocking something really simple here. What I want to do is add a block of text to a image created as my $graph = new GD::Graph::pie(1200, 1200); Could someone show me an example of adding a wrapbox of text to this image ? Thanks, -pete -- To unsubscribe, e-mail: [EMAIL

RE: Book on Perl!

2002-09-07 Thread Kowalski Pete-PKOWALS1
My personal choice is "PERL BLACK BOOK" http://www.amazon.com/exec/obidos/ASIN/1576104656/hotscrcomyourgui/002-58285 00-2101637 .:. -Original Message- .:. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] .:. Sent: Saturday, September 07, 2002 7:32 PM .:. To: [EMAIL PROTECTED];

Re: Detecting module existence

2002-09-05 Thread Pete Emerson
If I put a lot of subroutines in the BEGIN { } section, so that they load at compile-time, what is the disadvantage? BEGIN { eval { require Tk; }; if ($@) { # Do the NoGUI stuff here exit; } sub LotsOfSharedSubsHere { } } use Tk; print "GUI section.\n"; Lo

Re: Detecting module existence

2002-09-05 Thread Pete Emerson
I think I'm going in circles. Sorry about the multiple postings. The program barfs on 'use Tk' even though by the time I get to the 'use Tk' the Tk module should be installed. I tried doing require Tk; import Tk; but then I get this message: Bareword "MainLoop" not allowed while "strict subs" in

Re: Detecting module existence

2002-09-05 Thread Pete Emerson
I think I may have answered my own question. Is there a "better way" (TM) or a more efficient way? eval { require Tk }; if ($@) { # module is NOT installed # code here to make sure user is root and wants to proceed system('perl -MCPAN -e \'CPAN::Shell->install("Tk")\''); } use Tk; etc. etc.

Detecting module existence

2002-09-05 Thread Pete Emerson
^[Yy]/); print "You will have to answer a few questions if CPAN is not configured.\n"; print "Installation may take a while\n"; print "Press enter to continue\n"; $answer=; system('perl -MCPAN -e \'CPAN::Shell->install("Tk")\'')

use confusion

2002-05-31 Thread Pete Emerson
ssword'; } and then call sub Password from my main perl script, but that doesn't seem like "The Right Way To Do It". Should I be using require instead of use, or something else? Pete -- Those responsible for the signature have been sacked. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

SSL and IMAP

2002-03-28 Thread Pete Emerson
o IMAP and SSL, that would be great, too. Pete -- Those responsible for the signature have been sacked. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Help reqd. for collecting data

2002-01-23 Thread Pete Emerson
Here's my stab at it: #!/usr/bin/perl -w use strict; my %info; open INFILE, "$ARGV[0]" or die "Can't open file: $!\n"; # Open file specified on command line while () { chomp; my ($date, @data)=split; # Capture the date, then the rest $date=~s/_\d{4}$//; # Re

Re: Using SMPT on Windows NT

2002-01-10 Thread Pete Emerson
ndle. which can be downloaded and installed from www.cpan.org. Good luck! Pete Emerson -- Mynd you, møøse bites Kan be pretty nasti... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

IMAP via SSL

2002-01-09 Thread Pete Emerson
nybody have tips as to how to get this to work via SSL? I'm guessing I need to use Mail::IMAPClient's Socket() function, but I think maybe I need a different module (IO-Socket-SSL???) to help me out. Any pointers would be appreciated. Maybe there's a module to do IMAP via SSL?

Re: fun with regex/split

2001-12-12 Thread Pete Emerson
Jeff 'japhy' Pinyan wrote: > For the task of parsing quoted strings, my book suggests the inchworm > method: > > push @terms, $1 while > /\G\s*"([^"]*)"/g or > /\G\s*(\S+)/g; Hmmm...mine seems to go into an infinite loop: #!/usr/bin/perl -w use strict; my @terms; $_='"one two three"

Re: fun with regex/split

2001-12-12 Thread Pete Emerson
ot; foreach (@ar); This works, too, but I don't understand what the ?: is for; my Perl book says it doesn't do backreferences; what does that mean? Oh, fun with regexes. :) Pete -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

fun with regex/split

2001-12-12 Thread Pete Emerson
lace "one two" with "one_two" and "one two three" with "one_two_three", thinking that then I could split on spaces and then strip out the _, but I didn't have any luck with that, either. Any pointers would be greatly appreciated. Pete -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Digest::MD5

2001-12-11 Thread Pete Emerson
Is there a faster way to calculate the hex md5 of a file? sub md5 { my $file=shift; open (FILE, $file) or die "Can't open '$file': $!"; binmode(FILE); my $hash=Digest::MD5->new->addfile(*FILE)->hexdigest; close FILE; return $hash; } -- To unsubscribe, e-mail: [EMAIL PRO

detecting a hash of hashes

2001-12-06 Thread Pete Emerson
Here is an example of what I'm doing to detect whether I've got a scalar value in my hash or a hash of hashes: #!/usr/bin/perl -w use strict; my %hash; $hash{name}='Pete'; $hash{color}{favorite}='Blue'; $hash{color}{car}='Silver'; $hash{color}{hous

Parsing HTML for SPSS

2001-11-27 Thread Pete Emerson
ML source. Argh! Pete -- Mynd you, møøse bites Kan be pretty nasti... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: What is "bubble sort"?

2001-11-16 Thread Pete Emerson
Okay, so I'm trying to implement your radix sort, and something's going wrong. When I turn on warnings (I'm using Perl v5.6.0) I get: Multidimensional syntax $table[substr $_, $i, 1] not supported at ./sort3.pl line 31. and when I turn on strict: Can't use an undefined value as an ARRAY reference

Re: What is "bubble sort"?

2001-11-16 Thread Pete Emerson
hat happens. Okay, maybe it's wandering a little far from Perl Beginners, but it sure is interesting! Pete -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: What is "bubble sort"?

2001-11-16 Thread Pete Emerson
that the data is unsorted or random, it might be to your advantage to run the radix algorithm instead. Thoughts? Anyone done some testing on actual data? What's that timing module again? Pete -- Mynd you, møøse bites Kan be pretty nasti... -- To unsubscribe, e-mail: [EMAIL PRO

Re: What is "bubble sort"?

2001-11-16 Thread Pete Emerson
Since we're on the topic of sorts, what are the arguments for the implemented quicksort vs. a radix sort? Pete -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

extracting email addresses

2001-11-08 Thread Pete Emerson
When I send mail to a certain address, the mail gets piped to my perl script. I'm then using Mail::Internet to extract info, including the From header. For me, the header looks like this Pete Emerson <[EMAIL PROTECTED]> 1. I assume that they're all going to look different. Is tha

Re: imbed c programs in a perl script and vice versa

2001-11-02 Thread Pete Emerson
Well, suppose my C program does this: $ ./cprogram First Name: Pete Last Name: Emerson I could use a Perl program like this to analyse the output: The key is that the backticks execute any executable file and store the output. #!/usr/bin/perl -w use strict; my $cstuff=`./cprogram`; my

Re: imbed c programs in a perl script and vice versa

2001-11-02 Thread Pete Emerson
;); Now C calling a Perl program: perlhelloworld.pl #!/usr/bin/perl print "Hello, World, in Perl!\n"; cprinter.c gcc -o cprinter cprinter.c #include int main() { system("./perlhelloworld.pl"); } $ ./perlprinter.pl Hello, World, in C! $ ./cprinter H

Re: Problem performing a split using triangular brackets

2001-11-01 Thread Pete Emerson
dress\n"; $full_address=~/^"(.+)" <(.+)>$/; $user=$1; $email=$2; print "$user\'s email is $email\n"; If the format is ALWAYS going to be this way, this works, otherwise you might want to make the regex conditional and do some error checking. Hope that helps.

Re: returning more than 1 scalar from a subroutine

2001-10-31 Thread Pete Emerson
If I understand your question correctly, this will work: #!/usr/bin/perl -w use strict; my ($a, $b, $c, $one, $two, $three); $a=1; $b=2; $c=3; ($one, $two, $three)=Change($a, $b, $c); print "$one $two $three\n"; sub Change { my ($x, $y, $z)=@_; $x++; $y=0; $z=10; return ($x, $y, $z

File::Find and File::stat

2001-10-31 Thread Pete Emerson
generous person has more comments to make. I understand that this might not be the right place for a big "RFC on my program", so feel free to stop reading at this point .Thanks very much in advance. Pete #!/usr/bin/perl -w use strict; use File::

Re: flock() question

2001-10-30 Thread Pete Sergeant
look in to the alarm() function perldoc -f alarm +Pete -- [EMAIL PROTECTED] ;;($_='Yw_xUabcdtefgdijktljkotiersjkUzxT yvlkbfdtcierstajogvPruntRshackRJelov')=~ y&/RTUv;wxYz$&/ ~'/;$=();$&&&eval&&print <[EMAIL PROTECTED]> wrote in message

Re: logging out a user

2001-10-30 Thread Pete Sergeant
Find out your Perl PID, find out the user who's running it, and kill their session using `kill`? +Pete "Bob Showalter" <[EMAIL PROTECTED]> wrote in message 2E4528861499D41199D200A0C9B15BC031B508@FRISTX">news:2E4528861499D41199D200A0C9B15BC031B508@FRISTX

Re: beginners join function question

2001-10-30 Thread Pete Sergeant
open(NAMES, "names.txt")||die "$!"; ($result = join '', )=~s/\s+/ /g; +Pete -- [EMAIL PROTECTED] ;;($_='Yw_xUabcdtefgdijktljkotiersjkUzxT yvlkbfdtcierstajogvPruntRshackRJelov')=~ y&/RTUv;wxYz$&/ ~'/;$=();$&&&eval&&print

Re: Calling external executable with parameter under WinNT.

2001-10-30 Thread Pete Sergeant
> `"$batch" "$name"`; > #! doesn't work - and that's the clue of my problems > > and also system doesn't want to work with $batch and $name as it's parameter `` interpolates. You probably want: `"$batch $name"`; or

Re: good site..

2001-10-30 Thread Pete Sergeant
e CPAN.pm documentation interesting: http://www.perldoc.com/perl5.6.1/lib/CPAN.html Hope this helps +Pete -- [EMAIL PROTECTED] ;;($_='Yw_xUabcdtefgdijktljkotiersjkUzxT yvlkbfdtcierstajogvPruntRshackRJelov')=~ y&/RTUv;wxYz$&/ ~'/;$=();$&&&eval&&print -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: sub read_config is killing my daemon

2001-10-30 Thread Pete Sergeant
tory Or is it some other message all together? We have a saying somewhere I idle: Look buddy, doesn't work is a strong statement. Does it sit on the couch all day? Is it making faces at you? Does it want more money? Please be specific! So, please be specific! :

Re: perl source code instructions

2001-10-29 Thread Pete Sergeant
isbnInquiry.asp?mscssid=HMUFLHMEL5 NT8N6GL9PCMT2TD1FGAG12&isbn=0596000324 Or at any good bookstore. +Pete -- [EMAIL PROTECTED] ;;($_='Yw_xUabcdtefgdijktljkotiersjkUzxT yvlkbfdtcierstajogvPruntRshackRJelov')=~ y&/RTUv;wxYz$&/ ~'/;$=();$&&&eval&&a

Re: module and logicistics advice, please

2001-10-29 Thread Pete Sergeant
> What I don't yet understand is the other direction: How do I make > individual configuration variables, taken from database.cfg, available in > the modules or db.cgi? I guess that would be a job for "require", but am > not sure. You have a number of options. My prefered one is to do this: (opt

Re: Using the require command with perl

2001-10-29 Thread Pete Sergeant
isn't perl code and/or doesn't terminate with a true value, then you're doing something wrong. If you're getting an error about not being able to find the module, may I suggest: $file = "/absolute/path/to/files/$FORM{'id'}/options.txt"; eval "

Re: Problem comparing Strings with IF AND

2001-10-29 Thread Pete Sergeant
od ne $newmethod)) { ... } This is covered in perlop, which you can read by: o Going to http://www.perldoc.com and searching for perlop o Typing 'perldoc perlop' at a computer with Perl installed o Opening $perl_dir/html/lib/pod/perlop.html on a computer with Activestate Perl installed

Re: execuating fast...

2001-10-29 Thread Pete Sergeant
.com/pub/a/2001/04/10/engine.html is an article I wrote describing one situation where it's *faster* to use text files in a search engine... The best thing to do would be to write a simple test case for each and to test them, using perhaps the profiler discussed earlier. Happy to hel

Re: execuating fast...

2001-10-29 Thread Pete Sergeant
e faster, as far as I remember o Try profiling your Perl code to see where it slows down: Brian d Foy covers this in: http://www.ddj.com/columns/perl/2001/0104pl001/0104pl001.htm Uh. Before I go any futher I've found a webpage that offers the rest of my advice and some more: http://use.

Re: [Fwd: Stripping slashes in strings]

2001-10-29 Thread Pete Emerson
"string" if\and\only\if they're followed by a ' or ". Hope that helps. >From one beginner to another (i.e. someone else is about to point out a better way), Pete -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to split it?

2001-10-22 Thread Pete Emerson
I wonder why the use of sprintf? I would have done it this way: foreach (@list) { $_=":$_"; } Is there something that the sprintf does that I'm missing, or is this just another way to skin the same cat? Perhaps in other circumstances sprintf is superior? Just curious,

Re: Array of Hashes?

2001-09-24 Thread Pete Sergeant
> @hosts = ( list of hashes like below ... ); > %hosts = ( name => "hostname", > ipaddr => "www.xxx.yyy.zzz", > location => "location" >); > > How can produce a sorted list of the hashes based on the hostname and then > access each hash to print the details. > @hosts = sort { %{$a}

Inserting into the middle of arrays

2001-09-24 Thread Pete Sergeant
How do I insert $scalar into position $x of @array, where $x is smaller than $#array? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: perl and ftp

2001-09-21 Thread Pete Sergeant
ould suggest is writing a script that you 'require' that will return a username and password. You could do all kinds of magic to hide and encrypt the user/pass that this script returns, and so on. +Pete -- --- ($_='Yw_

  1   2   >