Re: Preserve order in a HoH

2005-03-10 Thread Ing. Branislav Gerzo
Harald Ashburner [HA], on Friday, March 11, 2005 at 15:26 (+1100) thinks about: HA> Other solutions that come to mind are: HA> create a separate data structure with the {order => key, etc HA> so I would access the strurcture with the data in it by iterating HA> through the order datastructure. Th

Re: Best way to check if element exists

2005-03-10 Thread mgoland
- Original Message - From: Ramprasad A Padmanabhan <[EMAIL PROTECTED]> Date: Friday, March 11, 2005 2:09 am Subject: Best way to check if element exists > Hi All, Hello, > Maybe this is OT , I am sorry for that. > > I have a specific email application , where I want to check if a >

RE: buffer is not being flushed

2005-03-10 Thread Thomas Bätzler
[EMAIL PROTECTED] <[EMAIL PROTECTED]> asked: > Any ideas... as the file is not being appended to. The > rights are correct, > 664 and it prints to the STDOUT which is my screen??? > open (FOO,">>$fout") || die "could not open file: $fout $!"; > > foreach my $dev (@devs) { > $dev .= "\n"

Best way to check if element exists

2005-03-10 Thread Ramprasad A Padmanabhan
Hi All, Maybe this is OT , I am sorry for that. I have a specific email application , where I want to check if a particular id exists or not in a file. Since this happens at real time I want the application to be as fast as possible. I am currently using DB_File hash, but that seem

Re: Preserve order in a HoH

2005-03-10 Thread mgoland
- Original Message - From: Harald Ashburner <[EMAIL PROTECTED]> Date: Thursday, March 10, 2005 11:26 pm Subject: Preserve order in a HoH > Greetings, Hello > > I've created a complicated structure using autovification that is > essentially a hash of hash of hash of hash etc. > > I pass

Re: Design Plugin System

2005-03-10 Thread Randy W. Sims
Santiago Hirschfeld wrote: Hi everyone, I'm pretty new to perl and i'm doing a program to organize music, I'd like to make a plugin system for the file formats, so i can just use the formats y ussually have, and not include a long list of "use" in my main program. I was thinking in create modules i

Re: Preserve order in a HoH

2005-03-10 Thread Marco Antonio Manzo
On Fri, 2005-03-11 at 15:26 +1100, Harald Ashburner wrote: > Greetings, > > I've created a complicated structure using autovification that is > essentially a hash of hash of hash of hash etc. > > I pass them to the template toolkit where I can get them all out and > put them in the right place on

Re: Preserve order in a HoH

2005-03-10 Thread Chris Devers
On Fri, 11 Mar 2005, Harald Ashburner wrote: > Is there an easy way to note and preserve ordering in a hash? No. The whole point of a hash is store things in a random order that is distributed evenly and that the computer can look up quickly. A hash is, almost by definition, an unordered mappin

Preserve order in a HoH

2005-03-10 Thread Harald Ashburner
Greetings, I've created a complicated structure using autovification that is essentially a hash of hash of hash of hash etc. I pass them to the template toolkit where I can get them all out and put them in the right place on the page. This all worked well and nicely. The late mail is that the re

buffer is not being flushed

2005-03-10 Thread DBSMITH
Any ideas... as the file is not being appended to. The rights are correct, 664 and it prints to the STDOUT which is my screen??? use strict; use warnings; use diagnostics; use MIME::Lite; use Logfile::Rotate; $ENV{"PATH"} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log); my @devs

Re: regular expression help

2005-03-10 Thread Stone
> $field =~ /^(?:([1-9]\d?)\.){2}\1$/; That won't work either. When you say ([1-9]\d?) you're telling it "(If there is a match) capture the stuff in parentheses and store it." When you say "\1" you're telling the script "you know that first batch of stuff you captured? Well I want that here."

Re: filehandle into a hash?

2005-03-10 Thread Todd W
"Wiggins d'Anconia" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > my @message = ; > > my %mails = ( > From=> "$from", > Subject => "$subject", > Message => join "", @message, > ); > or even just: > my %mails = ( > From=> "$from", > Subject => "$

Re: Design Plugin System

2005-03-10 Thread Todd W
"Santiago Hirschfeld" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi everyone, > > I'm pretty new to perl and i'm doing a program to organize music, I'd > like to make a plugin system for the file formats, so i can just use > the formats y ussually have, and not include a long li

RE: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[$#{@$a}]'

2005-03-10 Thread Jenda Krynicky
From: "Larsen, Errin M HMMA/IT" <[EMAIL PROTECTED]> > # [EMAIL PROTECTED] will be the number of elements in the array referenced > by > $a, minus one (or, '4', in this example) Well, yes most likely it will be, but it doesn't have to ;-) $#array is defined as the highest index in the array. Th

RE : Design Plugin System

2005-03-10 Thread Jose Nyimi
> -Message d'origine- > De : Santiago Hirschfeld [mailto:[EMAIL PROTECTED] > Envoyé : jeudi 10 mars 2005 21:58 > À : beginners@perl.org > Objet : Design Plugin System > > Hi everyone, > > I'm pretty new to perl and i'm doing a program to organize music, I'd > like to make a plugin syste

Re: regular expression help

2005-03-10 Thread Ing. Branislav Gerzo
Stone [S], on Thursday, March 10, 2005 at 12:51 (-0800) wrote the following: >> yes, and for complexity: >> >> $field =~ /^([1-9]\d?)\.{2}\1$/; S> I know you said that's untested, but I don't think it's correct. yes, I'm sorry for that, should be this correct: $field =~ /^(?:([1-9]\d?)\.){2}\1

Re: filehandle into a hash?

2005-03-10 Thread Wiggins d'Anconia
Gavin Henry wrote: On Thursday 10 Mar 2005 20:28, Wiggins d'Anconia wrote: [snip] Also note this can be somewhat dangerous since you will die anytime a message fails to send. The problem is, what if you have 10 messages and message 3 fails? 4-10 don't get sent, the problem is that 1-2 have been se

Design Plugin System

2005-03-10 Thread Santiago Hirschfeld
Hi everyone, I'm pretty new to perl and i'm doing a program to organize music, I'd like to make a plugin system for the file formats, so i can just use the formats y ussually have, and not include a long list of "use" in my main program. I was thinking in create modules in MyProg/AudioFormats/ wit

Re: regular expression help

2005-03-10 Thread Stone
> yes, and for complexity: > > $field =~ /^([1-9]\d?)\.{2}\1$/; I know you said that's untested, but I don't think it's correct. You're saying: 1. ^ - Start 2. ([1-9]\d?) -Any character 1-9 followed by zero or one digit characters. 3. \.{2} - Two periods. 4. \1 - The same sequence of charact

Re: filehandle into a hash?

2005-03-10 Thread Gavin Henry
On Thursday 10 Mar 2005 20:28, Wiggins d'Anconia wrote: > Gavin Henry wrote: > > Dear all, > > > > I have the following: > > > > #!/usr/bin/perl > > use strict; > > use warnings; > > use Mail::Sendmail; > > > > my $from = '"Test e-mails" <[EMAIL PROTECTED]>'; > > my $subject = 'Testing for survey e

Re: filehandle into a hash?

2005-03-10 Thread Gavin Henry
On Thursday 10 Mar 2005 20:29, Gavin Henry wrote: > I should have searched cpan!! > > http://search.cpan.org/~jimt/Mail-Bulkmail-3.12/ Nevermind, overkill. So my question still stands. > > -- > Just getting into the best language ever... > Fancy a [EMAIL PROTECTED] or something > on http://www.p

Re: filehandle into a hash?

2005-03-10 Thread Gavin Henry
I should have searched cpan!! http://search.cpan.org/~jimt/Mail-Bulkmail-3.12/ -- Just getting into the best language ever... Fancy a [EMAIL PROTECTED] or something on http://www.perl.me.uk Just ask!!! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTEC

Re: filehandle into a hash?

2005-03-10 Thread Wiggins d'Anconia
Gavin Henry wrote: Dear all, I have the following: #!/usr/bin/perl use strict; use warnings; use Mail::Sendmail; my $from = '"Test e-mails" <[EMAIL PROTECTED]>'; my $subject = 'Testing for survey e-mail'; open LIST, " open MESSAGE, " my $message = ; foreach () { my %mails = ( To => "$_"

Re: filehandle into a hash?

2005-03-10 Thread Ankur Gupta
Gavin Henry wrote: Dear all, I have the following: #!/usr/bin/perl use strict; use warnings; use Mail::Sendmail; my $from = '"Test e-mails" <[EMAIL PROTECTED]>'; my $subject = 'Testing for survey e-mail'; open LIST, " open MESSAGE, " my $message = ; foreach () { my %mails = ( To => "$_",

filehandle into a hash?

2005-03-10 Thread Gavin Henry
Dear all, I have the following: #!/usr/bin/perl use strict; use warnings; use Mail::Sendmail; my $from = '"Test e-mails" <[EMAIL PROTECTED]>'; my $subject = 'Testing for survey e-mail'; open LIST, "; foreach () { my %mails = ( To => "$_", From=> "$from", Subject => "$sub

Re: regular expression help

2005-03-10 Thread Ing. Branislav Gerzo
Peter Rabbitson [PR], on Thursday, March 10, 2005 at 14:00 (-0500) wrote: PR> I think what he really wants is to throw a fit when there is a leading zero PR> for which your solution won't cut it. Here is how I see it: PR> $field =~ /^[1-9]\d?\.[1-9]\d?\.[1-9]\d?$/ yes, and for complexity: $fiel

RE: regular expression help

2005-03-10 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Peter Rabbitson wrote: >> Simplest is change the {2} to {1,2} for all your entries. Now you >> mush have from 1 to 2 digits. Wags ;) > > > I think what he really wants is to throw a fit when there is a > leading zero for which your solution won't cut it. Here is how I see > it: > > $field =~ /^

Re: regular expression help

2005-03-10 Thread Peter Rabbitson
> Simplest is change the {2} to {1,2} for all your entries. Now you > mush have from 1 to 2 digits. > Wags ;) I think what he really wants is to throw a fit when there is a leading zero for which your solution won't cut it. Here is how I see it: $field =~ /^[1-9]\d?\.[1-9]\d?\.[1-9]\d?$/ --

RE: regular expression help

2005-03-10 Thread Wagner, David --- Senior Programmer Analyst --- WGO
CM Analyst wrote: > I am quite new to programming and Perl, so please bear > with me. > > I have a requirement to check the format of a field > before a record can be saved. The format of the field > needs to be double digit value separated by a . > (period) like "00.00.00". This I managed to do u

regular expression help

2005-03-10 Thread CM Analyst
I am quite new to programming and Perl, so please bear with me. I have a requirement to check the format of a field before a record can be saved. The format of the field needs to be double digit value separated by a . (period) like "00.00.00". This I managed to do using the following: use strict;

RE: Dead-module etiquette

2005-03-10 Thread Bob Showalter
Jeff Eggen wrote: > Hey all, > > I'm not sure if this question is germane here, but I'll give it a shot > anyways. > > I have a module in use in my environment, Time::Period. I haven't > seen > any other module with similar functionality. I would like to put some > improvements into the code,

Re: Dead-module etiquette

2005-03-10 Thread Jeff 'japhy' Pinyan
On Mar 10, Jeff Eggen said: I have a module in use in my environment, Time::Period. I haven't seen any other module with similar functionality. I would like to put some improvements into the code, so I emailed the author about it, but I'm not getting a response. The module hasn't been updated in

Dead-module etiquette

2005-03-10 Thread Jeff Eggen
Hey all, I'm not sure if this question is germane here, but I'll give it a shot anyways. I have a module in use in my environment, Time::Period. I haven't seen any other module with similar functionality. I would like to put some improvements into the code, so I emailed the author about it, but

Re: splitting based on index

2005-03-10 Thread Gretar M Hreggvidsson
Hi Could you describe a bit more what you are trying to accomplish? Gretar Mar Saurabh Singhvi wrote: hi all if (($pos = index($free,"M",$pos)) > -1) { print "Found at $pos\n"; } now what i want to do is except the part that was found in index should be out

Fwd: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[$#{@$a}]'

2005-03-10 Thread Platzhappyd
In a message dated 3/10/2005 8:00:12 AM Pacific Standard Time, [EMAIL PROTECTED] writes: beginners@perl.org Isn't this a classic example of LIFO in action? Brilliant little snippet! One could say "Less Is More", sometimes :-) Rich Platz --- Begin Message --- <> > > # or, since [EMAIL PROTECT

Re: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[$#{@$a}]'

2005-03-10 Thread Wiggins d'Anconia
Larsen, Errin M HMMA/IT wrote: <> # or, since [EMAIL PROTECTED] will always be the index of the last element of the array: print $a->[-1] Did I get it right? That looks like homework to me ... Why would you ever do that in a practical script? --Errin I think you got it. Ever want the last

RE: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[$#{@$a}]'

2005-03-10 Thread Larsen, Errin M HMMA/IT
<> > > # or, since [EMAIL PROTECTED] will always be the index of the last > element of > > the > > array: > > print $a->[-1] > > > > > > Did I get it right? That looks like homework to me ... Why > would you > > ever do that in a practical script? > > > > --Errin > > > > I think you

Re: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[$#{@$a}]'

2005-03-10 Thread Wiggins d'Anconia
Larsen, Errin M HMMA/IT wrote: -Original Message- From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] Sent: Thursday, March 10, 2005 8:55 AM To: Marcos Rebelo Cc: Perl Beginners Subject: Re: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[EMAIL PROTECTED]' Marcos Rebelo wrote: This is correc

RE: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[$#{@$a}]'

2005-03-10 Thread Larsen, Errin M HMMA/IT
> -Original Message- > From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 10, 2005 8:55 AM > To: Marcos Rebelo > Cc: Perl Beginners > Subject: Re: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[EMAIL PROTECTED]' > > > Marcos Rebelo wrote: > > This is correctly prin

RE: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[$#{@$a}]'

2005-03-10 Thread Marcos Rebelo
This really works, I didn't now that. Thanks Marcos Rebelo -Original Message- From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] Sent: quinta-feira, 10 de Março de 2005 14:55 To: Marcos Rebelo Cc: Perl Beginners Subject: Re: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[EMAIL PROTECTED]'

RE: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[$#{@$a}]'

2005-03-10 Thread Manav Mathur
;) $a is an anonymous reference to the array defined @$a resolves that reference [EMAIL PROTECTED] prints out the index of the last element of array $a->[elemmentnumber] is used to access an element thru an array reference. so $a->[EMAIL PROTECTED] simply gives you the last element of the array

Re: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[$#{@$a}]'

2005-03-10 Thread Harald Ashburner
On Thu, 10 Mar 2005 14:52:36 -, Marcos Rebelo <[EMAIL PROTECTED]> wrote: > This is correctly printing '7' but '$a->[EMAIL PROTECTED]' seems to be > encripted > code. > > Can I write this in a cleaner way? > perl -e '$a = [1,2,3,4,7]; print $a->[-1];' -- Kind regards, Hal Ashburner -- To

Re: Simplify perl -e '$a = [1,2,3,4,7]; print $a->[$#{@$a}]'

2005-03-10 Thread Wiggins d'Anconia
Marcos Rebelo wrote: This is correctly printing '7' but '$a->[EMAIL PROTECTED]' seems to be encripted code. Can I write this in a cleaner way? $a->[-1]; ??? http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Simplify perl -e '$a = [1,2,3,4,7]; print $a->[$#{@$a}]'

2005-03-10 Thread Marcos Rebelo
This is correctly printing '7' but '$a->[EMAIL PROTECTED]' seems to be encripted code. Can I write this in a cleaner way? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Reg Exp Help

2005-03-10 Thread Gretar M Hreggvidsson
Hi If "Request timed out" occurs in the output from PING command you can be quite sure that the request timed out. :-) Therefore it's be bit to much hazzle to check for embedded newlines (using the \m modifier), one could just say: if ($machine_status =~ /Request timed out\./) { Remember to es

splitting based on index

2005-03-10 Thread Saurabh Singhvi
hi all if (($pos = index($free,"M",$pos)) > -1) { print "Found at $pos\n"; } now what i want to do is except the part that was found in index should be outputted to another variable as an integer ...how should i do that?? thnx in adv rgds Saurabh -- To

Re: PDF creation

2005-03-10 Thread Owen
On Wed, 09 Mar 2005 16:07:31 -0500 "Wiggins d'Anconia" <[EMAIL PROTECTED]> wrote: > Peter Rabbitson wrote: > > I would like to hear opinions (pros/cons) about the two apparently > > available > > methods for realatively easy PDF output creation - PDF::Create and > > PDF::API2. > I recently (02

Re: DB_File Not getting hash values

2005-03-10 Thread Ramprasad A Padmanabhan
Ramprasad A Padmanabhan wrote: Hi, I have a simple script that reads a hashDB file into a tied hash. When I do a Dumper , I get the hash values , but when I pring a value nothing is printed ... what am I doing wrong here ? use DB_File; use strict; u

Re: PDF creation

2005-03-10 Thread Gretar M Hreggvidsson
I totally agree! PDF::API2 is utterly powerful, but the documentation is shamefully bad. I built a system to generate PDF invoices on the fly, for my company's sales department, using PDF::API2. When I started that project I wanted to use some template (HTML preferebly) so the graphic guru's

DB_File Not getting hash values

2005-03-10 Thread Ramprasad A Padmanabhan
Hi, I have a simple script that reads a hashDB file into a tied hash. When I do a Dumper , I get the hash values , but when I pring a value nothing is printed ... what am I doing wrong here ? use DB_File; use strict; use Data::Dumper; my %hash; my $

DB_File Not getting hash values

2005-03-10 Thread Ramprasad A Padmanabhan
Hi, I have a simple script that reads a hashDB file into a tied hash. When I do a Dumper , I get the hash values , but when I pring a value nothing is printed ... what am I doing wrong here ? use DB_File; use strict; use Data::Dumper; my %h