Re: undefined...

2005-05-24 Thread John W. Krahn
Ley, Chung wrote: I didn't know the use of Data::Dumper, wish I had known it earlier... Basically, I was trying to mimic what the Boxplot.pl was doing, and so I did a loop like this: for (my $k; defined $data[0][1][$k]; $k++ ) { print "data[0][1][$k] is defined

To Thread or not?

2005-05-24 Thread Tielman Koekemoer \(TNE\)
Hi all, I need to execute a shell command in a loop but the shell command takes about 1 minute to complete. I want to execute the shell command but but then continue processing. Usually I would "background" the process with & but this does not work as Perl waits for the process to exit before ret

Count special character

2005-05-24 Thread Joel Divekar
Hi All I want to search a string for a special character and count the occurance. My code is as follows : -- #!/usr/bin/perl -w my $a = "a:b:c:d:e:f:\:↔:↔:"; my $count = ($a =~ tr/\chr(29)//); print $count; -- Following code

RE: freebsd / ifconfig

2005-05-24 Thread Bob Showalter
Chris Knipe wrote: > Hi, > > Is there any modules available to manipulate devices (similar to > ifconfig) in perl? Basically, I need to give it a IP address, it > must find out what interface the IP belogs to, and what pid opened > the interface ??? I doubt it, because the process is so OS-spec

RE: To Thread or not?

2005-05-24 Thread brian . barto
If you are using a unix system, the fork function may help you. -Original Message- From: Tielman Koekemoer (TNE) [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 24, 2005 6:14 AM To: Perl Beginners Subject: To Thread or not? Hi all, I need to execute a shell command in a loop but the shell

hash reference help

2005-05-24 Thread Ing. Branislav Gerzo
Hi beginners@perl.org, I fetch results from table with fetchall_hashref, here is my snippet: my $hr = $get->fetchall_hashref('id'); while (my ($id, $value) = each(%$hr)) { get_something(); } sub get_something { foreach my $k ( reverse sort { $hr->{$a}{counter} <=> $hr->{$b}{counter} }

RE: To Thread or not?

2005-05-24 Thread Bob Showalter
Tielman Koekemoer (TNE) wrote: > Hi all, > > I need to execute a shell command in a loop but the shell command > takes about 1 minute to complete. I want to execute the shell command > but but then continue processing. Usually I would "background" the > process with & but this does not work as Per

Graphic files visual modofocation in Perl

2005-05-24 Thread Vladimir D Belousov
Hallo all! I beg your pardon for this question - the question more theoretical, rather than practical. Whether there is a modules for geometry transformation of the images? In particular, I need rotate and change geometry (perspective, resize)? Thanks a lot for any answers! -- Vladimir D Bel

RE: To Thread or not?

2005-05-24 Thread Tielman Koekemoer \(TNE\)
Thanks, I had a look at fork() and system(). I think system() would work better in my case. Thanks! -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED] Sent: 24 May 2005 02:34 PM To: Tielman Koekemoer (TNE); Perl Beginners Subject: RE: To Thread or not? Tielman Koekemoer (

RE: hash reference help

2005-05-24 Thread Charles K. Clarkson
Ing. Branislav Gerzo wrote: : Hi beginners@perl.org, : : I fetch results from table with fetchall_hashref, here is my snippet: : : my $hr = $get->fetchall_hashref('id'); It would be helpful to know what $hr looks like. Do this, and then show us what it looks like.

Re: Graphic files visual modofocation in Perl

2005-05-24 Thread Chris Devers
On Tue, 24 May 2005, Vladimir D Belousov wrote: > Whether there is a modules for geometry transformation of the images? > In particular, I need rotate and change geometry (perspective, > resize)? Yes. ImageMagick is the most common way to do this. It's a toolkit for making all kinds of image man

Re: Graphic files visual modofocation in Perl

2005-05-24 Thread Vladimir D Belousov
Chris Devers wrote: On Tue, 24 May 2005, Vladimir D Belousov wrote: Whether there is a modules for geometry transformation of the images? In particular, I need rotate and change geometry (perspective, resize)? Yes. ImageMagick is the most common way to do this. It's a toolkit for ma

Re: hash reference help

2005-05-24 Thread Ing. Branislav Gerzo
Charles K. Clarkson [CKC], on Tuesday, May 24, 2005 at 08:16 (-0500) thinks about: CKC> It would be helpful to know what $hr looks like. Do this, and then CKC> show us what it looks like. Show a partial dump if this is too long. CKC> use Data::Dumper 'Dumper'; CKC> print Dumper $hr; in select

chr function on z/OS.

2005-05-24 Thread rajarshi das
Hi, I have a basic doubt regarding unicode and z/OS (ebcdic : ibm-1047). $a = chr(0x00A1); $b = chr(0xA1); Should $a and $b be equal or yield different results ? $b is definitely the character "~". Is $a also the same thing or is it the character equivalent to "\xAA" ? $a on linux gives me

a question about print in array

2005-05-24 Thread Frank
I met an interesting problem recently and am expecting your kind advice. my input file (for_test) is like as follows. I wish add a ">" to the first line (before the word blue) and remove ">" at the last line. # ---begining of the file, this line is not included in the file---# blue sky ski

Re: a question about print in array

2005-05-24 Thread Jeff 'japhy' Pinyan
On May 24, Frank said: print OUTPUT "@items\n"; When you place an array inside quotes, it's the same as saying join($", @array) where $" is the "list separator" variable, whose default value is " " (a single space). Thus, if @array is ("this", "that", "those"), then "@array" is "this th

Re: assigning printf statement to an array

2005-05-24 Thread DBSMITH
my @a= map {$hdir.$_->[1]} # select filename grep {$_->[0] > 100} # exclude age <= 100 map { [ sprintf ("%.0f",( $now - ( stat("${hdir}$_" ) )[9] ) / ONE_DAY ), $_ ] } # create aref [age, filename] grep {$_ ne "." and $_ ne ".."} # exclude unwanted sort readdir DH; # get all files The map-gr

while loop -> map

2005-05-24 Thread Robert Citek
I found a variation of this in the Perl Nutshell book: $ perl -le ' $foo="fee fie foe foo" ; while ($foo =~ m/e/g ) { push @bar, pos $foo ; } print join(":", @bar); ' 2:3:7:11 Is there an equivalent way to do the same using map instead of an explicit while loop? I'm guessing not, sinc

Re: efficiency of hash of hashes/lists

2005-05-24 Thread Dave Gray
On 5/23/05, Peter Rabbitson <[EMAIL PROTECTED]> wrote: > On Mon, May 23, 2005 at 01:40:08PM -0400, Zhenhai Duan wrote: > > I tried hash (where the members of a group are joined with ":"), and hash > > of hash. It happended that hash of hash is slower than single hash. > > > > Hash: > > $groups{$g1}

Return CD-ROM/RW Creation Date

2005-05-24 Thread ahuber
Platform: Windows Version: Active State v5.8.36 build number 811 Is there a way to find out the creation date (or burn date) of a cd-rw disc? I tried using things like $burndate = (stat("."))[9], but on windows there is no current directory entry for CD media, it always returns an old date like 19

Re: efficiency of hash of hashes/lists

2005-05-24 Thread Philip M. Gollucci
Dave Gray wrote: On 5/23/05, Peter Rabbitson <[EMAIL PROTECTED]> wrote: On Mon, May 23, 2005 at 01:40:08PM -0400, Zhenhai Duan wrote: I tried hash (where the members of a group are joined with ":"), and hash of hash. It happended that hash of hash is slower than single hash. Hash: $gr

Re: efficiency of hash of hashes/lists

2005-05-24 Thread Paul Johnson
On Tue, May 24, 2005 at 02:13:49PM -0400, Dave Gray wrote: > On 5/23/05, Peter Rabbitson <[EMAIL PROTECTED]> wrote: > > On Mon, May 23, 2005 at 01:40:08PM -0400, Zhenhai Duan wrote: > > > I tried hash (where the members of a group are joined with ":"), and hash > > > of hash. It happended that has

Re: efficiency of hash of hashes/lists

2005-05-24 Thread Dave Gray
> > # access test for 2d > > ($su, $ss) = times; > > for my $i (0 .. $hashsize-1) { > > $oned{$l1[$i]}{$l2[$i]}++ > > I think you should be operating on %twod here. LOL, thanks. Original poster take note: generating hashes..! base 0.03 0.00 0.03

Fw: assigning printf statement to an array

2005-05-24 Thread DBSMITH
- Forwarded by Derek Smith/Staff/OhioHealth on 05/24/2005 03:47 PM - Derek Smith/Staff/OhioH

Using $# in a splice with split

2005-05-24 Thread Larsen, Errin M HMMA/IT
Hi Perl buddies, Can I do something like this: my $line = 'One Two Three Four Five Six'; my( $first, $last ) = (split(' ', $line))[0,$#(split(' ', $line))]; This does not work. What I want to do is to find the index of the last element of a list created by split, and use it in a slice on th

Re: while loop -> map

2005-05-24 Thread Xavier Noria
On May 24, 2005, at 19:22, Robert Citek wrote: I found a variation of this in the Perl Nutshell book: $ perl -le ' $foo="fee fie foe foo" ; while ($foo =~ m/e/g ) { push @bar, pos $foo ; } print join(":", @bar); ' 2:3:7:11 Is there an equivalent way to do the same using map instead of a

Re: assigning printf statement to an array

2005-05-24 Thread John Doe
Hi Am Dienstag, 24. Mai 2005 18.05 schrieb [EMAIL PROTECTED] with funny quoting: [John:] > my @a= > map {$hdir.$_->[1]} # select filename > grep {$_->[0] > 100} # exclude age <= 100 > map { [ > sprintf ("%.0f",( $now - ( stat("${hdir}$_" ) )[9] ) / ONE_DAY ), > $_ > ] } # create aref [age,

Re: while loop -> map

2005-05-24 Thread John Doe
Am Dienstag, 24. Mai 2005 19.22 schrieb Robert Citek: > I found a variation of this in the Perl Nutshell book: > > $ perl -le ' > $foo="fee fie foe foo" ; > while ($foo =~ m/e/g ) { > push @bar, pos $foo ; > } > print join(":", @bar); ' > 2:3:7:11 > > Is there an equivalent way to do th

Re: why getstore can't work, especially for store xml file on freebsd

2005-05-24 Thread John Doe
Am Dienstag, 24. Mai 2005 08.59 schrieb Franklin: > Hi; > > I have a small program that uses getstore to fetch a xml webpahe and > store it. It is: > > use strict; > use warnings; > > use LWP::Simple; > > my > $xmlurl="http://www.sec.gov/Archives/edgar/data/903404/000118143105029692/r >rd79736.xml"

Re: assigning printf statement to an array

2005-05-24 Thread DBSMITH
operdir . 1> print 2> map {$_->[1].": ".$_->[0]."\n"} # create entity output 3> grep {$_->[0] > 100} # exclude age <= 100 4> map { [ 5> sprintf ("%.0f",( $now - ( stat("${hdir}$_" ) )[9] ) / ONE_DAY ), 6> $_ 7> ] } # create aref [age, filename] 8> grep {$_ ne "." and $_ ne ".."} # exclude un

Re: why getstore can't work, especially for store xml file on freebsd

2005-05-24 Thread Franklin
Sometimes it ok. But when you run it many times, say 1,000 times, there is serveral times that it return 200, but the stored file is 0 bytes, titally empty. > On 5/25/05, John Doe <[EMAIL PROTECTED]> wrote: > > Am Dienstag, 24. Mai 2005 08.59 schrieb Franklin: > > > Hi; > > > > > > I have a sm

Re: assigning printf statement to an array

2005-05-24 Thread Jeff 'japhy' Pinyan
On May 24, [EMAIL PROTECTED] said: 1> print 2> map {$_->[1].": ".$_->[0]."\n"} # create entity output 3> grep {$_->[0] > 100} # exclude age <= 100 4> map { [ 5> sprintf ("%.0f",( $now - ( stat("${hdir}$_" ) )[9] ) / ONE_DAY ), 6> $_ 7> ] } # create aref [age, filename] 8> grep {$_ ne "." and $

Re: Count special character

2005-05-24 Thread Jeff 'japhy' Pinyan
On May 24, Joel Divekar said: #!/usr/bin/perl -w my $a = "a:b:c:d:e:f:\:↔:↔:"; my $count = ($a =~ tr/\chr(29)//); That doesn't work. First of all, '↔' in Perl is just 7 characters in a row. HTML entity codes are for HTML, not Perl. If you want character #8596 in Perl, you have to use ch

Re: hash reference help

2005-05-24 Thread Offer Kaye
On 5/24/05, Ing. Branislav Gerzo wrote: > > it was easy mistake, everything we should know about this is avoid > using keys() on %$hr in while loop, because it resets iterator. That's > all. Well, that, and don't change the hash inside the while loop. In your original email you wrote: "and get_s

Can't use subscript in angle brackets

2005-05-24 Thread Tielman Koekemoer \(TNE\)
Hi all, Why can't I use a subscript in the angle brackets? e.g. @files=`ls /app2/koekemtn/scripts/dbstats/test`; chomp $files[0]; open ( $files[0] , "<$files[0]") || die "Cannot open $files[0]\n"; while (<$files[0]>) { print "$_"; } TIA

Re: Can't use subscript in angle brackets

2005-05-24 Thread John W. Krahn
Tielman Koekemoer (TNE) wrote: Hi all, Hello, Why can't I use a subscript in the angle brackets? e.g. @files=`ls /app2/koekemtn/scripts/dbstats/test`; chomp $files[0]; open ( $files[0] , "<$files[0]") || die "Cannot open $files[0]\n"; while (<$files[0]>) { print "$_"; } perldoc

Re: hash reference help

2005-05-24 Thread Ing. Branislav Gerzo
Offer Kaye [OK], on Wednesday, May 25, 2005 at 09:09 (+0300) typed the following: >> it was easy mistake, everything we should know about this is avoid >> using keys() on %$hr in while loop, because it resets iterator. That's >> all. OK> Well, that, and don't change the hash inside the while loo

Re: while loop -> map

2005-05-24 Thread Ing. Branislav Gerzo
Xavier Noria [XN], on Tuesday, May 24, 2005 at 22:12 (+0200) typed the following: XN> my $i = 0; XN> my @bar = map $_->[1], # take second component XN>grep $_->[0] eq 'e', # let 'e's pass XN>map [$_, ++$i],# arrayref [char, index of cha

Re: while loop -> map

2005-05-24 Thread Offer Kaye
On 5/24/05, Robert Citek wrote: > > I found a variation of this in the Perl Nutshell book: > > $ perl -le ' > $foo="fee fie foe foo" ; > while ($foo =~ m/e/g ) { > push @bar, pos $foo ; > } > print join(":", @bar); ' > 2:3:7:11 > > Is there an equivalent way to do the same using map