RE: perl/Tk and piping questions

2006-08-28 Thread John Cortland Morgan \(ZG/ETK\)
Hi, Thanks for the tip about The book Mastering Perl/Tk has a pretty good Chapter 3 on Geometry Management. You can probably read it for free with an sign up at http://safari.oreilly.com/ about the piping question, it's not an either/or situation. It could be both. A good example is

Image split....

2006-08-28 Thread Nagasamudram, Prasanna Kumar
Hi All Can anybody suggest me any module/script that can be used to split and image into pieces? I tried to search in CPAN also googled a lot. I could only find image splitting software..but I need command line utility. Thanks Prasanna

Re: Image split....

2006-08-28 Thread Gretar Mar Hreggvidsson
Hi I would probably use the module Imager (see CPAN), and it's crop() function. The function doesn't modify the source, it returns a new, cropped image based on the coordinates you submit to it. Best regards, Grétar Mar Nagasamudram, Prasanna Kumar wrote: Hi All Can anybody suggest

RE: Image split....

2006-08-28 Thread Nagasamudram, Prasanna Kumar
-Original Message- From: Gretar Mar Hreggvidsson [mailto:[EMAIL PROTECTED] Sent: Monday, August 28, 2006 5:29 PM To: Nagasamudram, Prasanna Kumar Cc: beginners@perl.org Subject: Re: Image split Hi I would probably use the module Imager (see CPAN), and it's crop() function. The

Re: Image split....

2006-08-28 Thread Gretar Mar Hreggvidsson
But If I change the following line $img-read(file='p.bmp', type='bmp') or die $img-errstr(); TO $img-read(file='p.jpg', type='jpg') or die $img-errstr(); I get the following error. format 'jpg' not supported at i.pl line 4. The same is for other formatsexcept bmp.

hash lookup table

2006-08-28 Thread Derek B. Smith
All, I am trying to run logic that will copy/delete 3 versions of log.\d+ files to their respective directories. Because there are so many directories, I have built a hash table instead of using a bunch of if else conditions with reg exps. My problem is it is not returning the words_num

odd variable result

2006-08-28 Thread Curt Shaffer
List, I am trying to set a variable based on a system call. Here is my code: #!/usr/bin/perl use strict; my $test = system `/usr/bin/snmpget -v1 10.1.11.18 -c secret .1.3.6.1.4.1.710.7.1.5.1.23.1.13.1|awk '{print $4}'`; print $test\n; When I run that command from the

re: hash lookup table

2006-08-28 Thread Lawrence Statton XE1/N1GAK
Trivial problem. What does $words *really* contain in your subrotuine words_to_num? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: odd variable result

2006-08-28 Thread Derek B. Smith
try this syntax: my $test = system (/usr/bin/snmpget -v1 10.1.11.18 -c secret .1.3.6.1.4.1.710.7.1.5.1.23.1.13.1|awk '{print $4}'); or my $test = qx(you command above w/no quotes needed); or open (SNMP, snmpget -v1 10.1.11.18 -c secret .1.3.6.1.4.1.710.7.1.5.1.23.1.13.1 ) or die failed

RE: odd variable result

2006-08-28 Thread Curt Shaffer
They all seem to skip the awk command. For your open example, I am confused. It gives me the error: failed opening snmpget No such file or directory at ./test.pl line 5. Thanks -Original Message- From: Derek B. Smith [mailto:[EMAIL PROTECTED] Sent: Monday, August 28, 2006 10:05 AM To:

Very dangerous code

2006-08-28 Thread Nath, Alok (STSD)
Hi, I have this web page which saves data in an xml. The web page has few textfields which takes input and has a submit button.The data is saved in an XML when pressed the submit button. I am using CGI module for web page and

Re: odd variable result

2006-08-28 Thread John W. Krahn
Curt Shaffer wrote: List, Hello, I am trying to set a variable based on a system call. In Perl a system call would be open() or link() or crypt(), etc. You mean that you are trying to set a variable based on the output of an external program. Here is my code: #!/usr/bin/perl use

Re: hash lookup table

2006-08-28 Thread John W. Krahn
Derek B. Smith wrote: All, Hello, I am trying to run logic that will copy/delete 3 versions of log.\d+ files to their respective directories. Because there are so many directories, I have built a hash table instead of using a bunch of if else conditions with reg exps. My problem is it

Re: odd variable result

2006-08-28 Thread John W. Krahn
Curt Shaffer wrote: From: John W. Krahn [mailto:[EMAIL PROTECTED] Curt Shaffer wrote: my $test = system `/usr/bin/snmpget -v1 10.1.11.18 -c secret .1.3.6.1.4.1.710.7.1.5.1.23.1.13.1|awk '{print $4}'`; You are using back-quotes AND system() so if your external command displayed the

number rounding problem

2006-08-28 Thread Howard, Chris
Hi, I don't know if this is the right mailing list for this question. Let me know if I should go somewhere else. The issue is a number rounding problem. Here is my perl snippet: $credit = 64.63; $amount = $credit * 1000; printf credit %s, amount %12.12d\n, $credit, $amount; $amount =

Re: number rounding problem

2006-08-28 Thread Adriano Ferreira
Chris, printf credit %s, amount %12.12d\n, $credit, $amount; What really went wrong was to use a %d specifier. It says to truncate a floating number into integer. Like it happens in $ perl -e 'print int 1000*shift' 64.63 64629 If you use %f, it may improve $ perl -e 'printf %f,

Re: number rounding problem

2006-08-28 Thread Dr.Ruud
Howard, Chris schreef: What starts out as 64.63 ends up being 0006462 No, it ends up beint printed as that. Replace your %12.12d by one of (%s, %f, %g) to get different representations. See also perldoc -q decimals -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe,

RE: number rounding problem

2006-08-28 Thread Howard, Chris
But the file output format I'm required to produce is 12 positions with leading zeros and no decimal. :-( Chris -Original Message- From: Dr.Ruud [mailto:[EMAIL PROTECTED] Sent: Monday, August 28, 2006 11:17 AM To: beginners@perl.org Subject: Re: number rounding problem Howard,

RE: number rounding problem

2006-08-28 Thread John Cortland Morgan \(ZG/ETK\)
Something with word size of multiplying by 1000, I'd venture. This works as you need, I think: $credit = 64.63; $amount = $credit * 100; printf credit %s, amount %12.12d\n, $credit, $amount; $amount = $amount * 10; printf credit %s, amount %12.12d\n, $credit, $amount; $amount = $amount /

Re: number rounding problem

2006-08-28 Thread Dr.Ruud
Howard, Chris schreef: [next time, do not toppost, and quote more effectively] Ruud: Chris: What starts out as 64.63 ends up being 0006462 No, it ends up beint printed as that. Replace your %12.12d by one of (%s, %f, %g) to get different representations. But the file output format

Re: hash lookup table

2006-08-28 Thread Derek B. Smith
--- John W. Krahn [EMAIL PROTECTED] wrote: Derek B. Smith wrote: All, Hello, I am trying to run logic that will copy/delete 3 versions of log.\d+ files to their respective directories. Because there are so many directories, I have built a hash table instead of using a bunch

Re: hash lookup table

2006-08-28 Thread Mumia W.
On 08/28/2006 08:37 AM, Derek B. Smith wrote: All, I am trying to run logic that will copy/delete 3 versions of log.\d+ files to their respective directories. Because there are so many directories, I have built a hash table instead of using a bunch of if else conditions with reg exps.

RE: number rounding problem

2006-08-28 Thread Howard, Chris
Thanks! -Original Message- From: Dr.Ruud [mailto:[EMAIL PROTECTED] Sent: Monday, August 28, 2006 12:00 PM To: beginners@perl.org Subject: Re: number rounding problem Howard, Chris schreef: [next time, do not toppost, and quote more effectively] Ruud: Chris: What starts out as

RE: perl/Tk and piping questions

2006-08-28 Thread Ken Foskey
On Mon, 2006-08-28 at 12:27 +0200, John Cortland Morgan (ZG/ETK) wrote: This will test for a pipe #!/usr/bin/perl # -t tests if a tty is input, else it's a pipe if (@ARGV == 0 and -t) { die Usage: $0 INPUT\n; } while () { ## process input file(s)

Re: hash lookup table

2006-08-28 Thread John W. Krahn
Derek B. Smith wrote: --- John W. Krahn [EMAIL PROTECTED] wrote: Derek B. Smith wrote: I am trying to run logic that will copy/delete 3 versions of log.\d+ files to their respective directories. Because there are so many directories, I have built a hash table instead of using a bunch of if

Reading Excel spreadsheet into variables

2006-08-28 Thread Stephan Gross
I'm reading in an Excel spreadsheet using Win32::OLE. I want to read in the entire spreadsheet. I found a piece of code that does that: $everything = $sheet-UsedRange()-{Value}; for (@$everything) { for (@$_) { print defined($_) ? $_| : undef|; } print \n; } However,

How do i open excel files under linux

2006-08-28 Thread Toddy Prawiraharjo
Is it possible to open excel files under linux? I read about libwin32, and it seems it doesn't work under linux. Is this true? Thank in advance Toddy

RE: How do i open excel files under linux

2006-08-28 Thread Timothy Johnson
This is true, however I believe Spreadsheet::ParseExcel still works under Linux. -Original Message- From: Toddy Prawiraharjo [mailto:[EMAIL PROTECTED] Sent: Monday, August 28, 2006 4:05 PM To: beginners@perl.org Subject: How do i open excel files under linux Is it possible to open

RE: Reading Excel spreadsheet into variables

2006-08-28 Thread Timothy Johnson
$everything is a scalar reference to an array. You can dereference the array with the '@$everything' notation or the '@{$everything}' notation. (The second one removes any ambiguity about the reference, but 99% of the time the first way is okay.) You can access elements of the array by either

Re: How do i open excel files under linux

2006-08-28 Thread Sastry
Use Open Office On 8/29/06, Toddy Prawiraharjo [EMAIL PROTECTED] wrote: Is it possible to open excel files under linux? I read about libwin32, and it seems it doesn't work under linux. Is this true? Thank in advance Toddy

RE: How do i open excel files under linux

2006-08-28 Thread Toddy Prawiraharjo
LOL Thanks all, Im using Spreadsheet::ParseExcel, ::Read, and ::ReadSXC. I'm rolling now. Found out also xls2csv is very2x helpful. Cheers! Toddy Prawiraharjo -Original Message- From: Sastry [mailto:[EMAIL PROTECTED] Sent: Tuesday, 29 August 2006 1:45 PM To: [EMAIL PROTECTED] Cc:

how to make http cgi-perl script work for https

2006-08-28 Thread krishna prasad
Hi, I an very new to CGI and want to know how to make the CGI(with perl) pages presently working on http work on https. I have the following webpage Logout.cgi. #!/opt/plat/bin/perl use strict; use Time::localtime; use CGI; use CGI::Carp 'fatalsToBrowser'; use lib /opt/appl/web/cgi-bin; use GS;