Re: list syntax for backquote-like functionality

2003-07-23 Thread Ramprasad
Aaron Christopher Vonderhaar wrote: Dear kind perl guru: I am aware of the differences between qx// and system(), but here is my problem... $s = "\`backquoted'string\`" print $s,"\n"; #=> `backquoted'string` system ("echo", $s); #=> `backquoted'string` system "echo $s"; #=> sh: comman

RE: Colorize Table Elements

2003-07-23 Thread Charles K. Clarkson
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: : : foreach my $keyer (@keysarray) { : if ($condorhash{$keyer} eq "FINISHED" ) {delete $condorhash{$keyer}}; : if ($condorhash{$keyer} eq "STARTED") {$condorhash{$keyer} = "font({-color=>'green'}STARTED)"}; : if ($condorhash{$keyer} eq "VACATING"

Re: Should i use Perl

2003-07-23 Thread Sachin Hegde
Thanks for replyng for my bitwise query. The reason why i need it is, coz I have to design an application which has to parse a file which stores data in hex. By this I meant it is a text file but the contents are to be interpreted as hex numbers Then I have to display the contents in a

Re: Sort -u emulation

2003-07-23 Thread Steve Grazzini
On Wed, Jul 23, 2003 at 02:52:23PM -0700, John W. Krahn wrote: > Steve Grazzini wrote: > > The advantages are that (a) it doesn't change the order > > of the input array and (b) it's a common idiom that the > > next programmer in line will recognize instantly. > > > > The hash-keys version would p

Re: Sort -u emulation

2003-07-23 Thread John W. Krahn
Dan Muey wrote: > > Kevin Pfeiffer wrote: > > > > BTW, doesn't 'sort -u' also sort the list? > > sort -u opens a file and prints to STDOUT or another file the unique lines, > but that is an external command and not every server will necessariy have a > sort command and if it does -u may have a

RE: Sort -u emulation

2003-07-23 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Dan Muey wrote: > [Kevin wrote:] >> BTW, doesn't 'sort -u' also sort the list? > > sort -u opens a file and prints to STDOUT or another file the unique > lines, > but that is an external command and not every server will necessariy have > a sort command and if i

RE: Sort -u emulation

2003-07-23 Thread Dan Muey
> >> @unique = keys %{ > >> my %set; > >> @set{ @arr } = (); # fast! > >> \%set; > >> }; > > > > One question why doesn't use strict; complain about @set? > > Heh, I think I just posted about this. Unless my memory deceives me, > "@set{ @arr }" is a hash slice. That is, i

Re: Sort -u emulation

2003-07-23 Thread John W. Krahn
Steve Grazzini wrote: > > On Wed, Jul 23, 2003 at 03:25:53PM -0500, Dan Muey wrote: > > That must be in perldoc sine you both had the same example > > but I couldn't find it and the perldoc your recommended Bob > > couldn't be found! > > > > I like this very much and I'm assuming it's faster than

Re: Sort -u emulation

2003-07-23 Thread John W. Krahn
Kevin Pfeiffer wrote: > > In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > > > > Ok, but it may be a bit long. :-) > > > > my $file = 'file.txt'; > > > > my @unique = do { > > open my $fh, '<', $file or die "Cannot open $file: $!"; > > my %seen; > > grep !$seen{$_}++, <$fh> > >

list syntax for backquote-like functionality

2003-07-23 Thread Aaron Christopher Vonderhaar
Dear kind perl guru: I am aware of the differences between qx// and system(), but here is my problem... $s = "\`backquoted'string\`" print $s,"\n"; #=> `backquoted'string` system ("echo", $s); #=> `backquoted'string` system "echo $s"; #=> sh: command substitution: line 1: unexpect

RE: Sort -u emulation

2003-07-23 Thread Dan Muey
> > Dan Muey wrote: > [...] > >> I currently have to do this via the command line: > >> > >> my @unique = qx(sort -u file.txt); > >> > >> To remove duplicat elines from file.txt. > >> > >> What would be the best way to do the same thign with perl > instead of > >> calling an external program

RE: Sort -u emulation

2003-07-23 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Dan Muey wrote: >> The hash-keys version would probably be a bit faster: >> >> @unique = keys %{ >> my %set; >> @set{ @arr } = (); # fast! >> \%set; >> }; > > One question why doesn't use strict; complain about @set? Heh, I think I just

Re: Sort -u emulation

2003-07-23 Thread Kevin Pfeiffer
Hi, In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > Dan Muey wrote: [...] >> I currently have to do this via the command line: >> >> my @unique = qx(sort -u file.txt); >> >> To remove duplicat elines from file.txt. >> >> What would be the best way to do the same thign with perl instead

RE: Sort -u emulation

2003-07-23 Thread Dan Muey
> The hash-keys version would probably be a bit faster: > > @unique = keys %{ > my %set; > @set{ @arr } = (); # fast! > \%set; > }; One question why doesn't use strict; complain about @set? Dan > > But karma is more important than (a smidgen of) speed. > > -- > Steve

RE: Sort -u emulation

2003-07-23 Thread Dan Muey
> > I like this very much and I'm assuming it's faster than > > putting them in hash and returning the keys as an array > > since you don't have to build a hash. > > Actually you *do* build a hash. :-) Oh yeah, duh what am I smoking? > > > @unique = do { > > my %seen; > > grep !$seen{$

Re: Sort -u emulation

2003-07-23 Thread Steve Grazzini
On Wed, Jul 23, 2003 at 03:25:53PM -0500, Dan Muey wrote: > That must be in perldoc sine you both had the same example > but I couldn't find it and the perldoc your recommended Bob > couldn't be found! > > I like this very much and I'm assuming it's faster than > putting them in hash and returnin

RE: Sort -u emulation

2003-07-23 Thread Dan Muey
Ahh very nice, I don't have 5.8 yet on this box so that may be why I didn't have it. Thanks for the link I'll bookmark that sucker! Thanks Dan > > Dan Muey wrote: > > Thanks Bob and John, > > > > That must be in perldoc sine you both had the same example but I > > couldn't find it and the pe

RE: Colorize Table Elements

2003-07-23 Thread LoBue, Mark
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 23, 2003 1:18 PM > To: [EMAIL PROTECTED] > Subject: Colorize Table Elements > > > I am creating a program that will display different states of > a server by creating a web page that uses the

Re: parsing PDF documents

2003-07-23 Thread Michele Marcionelli
You can download and install xpdf, that actually contains "pdftotext" and other tools: http://www.foolabs.com/xpdf/download.html Cheers, Michele -- Michele Marcionelli - [EMAIL PROTECTED] - Phone: +41 1 632 6193 Address: HG G 14 - Rämistrasse 101 - 8092 Zürich - Switzerland - Original Mes

RE: Sort -u emulation

2003-07-23 Thread Bob Showalter
Dan Muey wrote: > Thanks Bob and John, > > That must be in perldoc sine you both had the same example but I > couldn't find it and the perldoc your recommended Bob couldn't be > found! Here's the FAQ article online:

Re: Reordering Hash

2003-07-23 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, John W. Krahn wrote: [...] > If you just want to print the values of %condorhash you could do this: > > print @condorhash{ @condorkeys }; After staring at this strange line for a while I think I finally remembered that this is a "hash slice"... (was in the book '

RE: parsing PDF documents

2003-07-23 Thread Sommer, Henrik
Ray, Yes, you need to call an executable called pdftotext. Once the PDF is made into text you can parse that. HS -Original Message- From: Ray Seals [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:29 PM To: Perl Subject: parsing PDF documents I know that normally the question

RE: Sort -u emulation

2003-07-23 Thread Dan Muey
Thanks Bob and John, That must be in perldoc sine you both had the same example but I couldn't find it and the perldoc your recommended Bob couldn't be found! I like this very much and I'm assuming it's faster than putting them in hash and returning the keys as an array since you don't have to

parsing PDF documents

2003-07-23 Thread Ray Seals
I know that normally the question would be, how do I create a PDF from perl. My question, is there a perl module that would allow me to open a PDF and parse it for specific information? There are a series of pdf files that are generated weekly. I want to read the file and pull out about 15 lines

Colorize Table Elements

2003-07-23 Thread bseel
I am creating a program that will display different states of a server by creating a web page that uses the CGI module to display the information, and perl and other modules in the background getting the information from the server. I have created a hash that has the ID and STATUS of certain pr

Re: Sort -u emulation

2003-07-23 Thread John W. Krahn
Dan Muey wrote: > > Howdy list Hello, > I currently have to do this via the command line: > > my @unique = qx(sort -u file.txt); > > To remove duplicat elines from file.txt. > > What would be the best way to do the same thign with perl instead of calling an > external program? > > I can al

RE: Sort -u emulation

2003-07-23 Thread Bob Showalter
Dan Muey wrote: > Howdy list > > I currently have to do this via the command line: > > my @unique = qx(sort -u file.txt); > > To remove duplicat elines from file.txt. > > What would be the best way to do the same thign with perl > instead of calling an external program? > > I can always assig

Re: Reordering Hash

2003-07-23 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > > I need to order a hash, called condorhash, based on the key value. > So what I did is: > > my @condorhash = keys(%condorhash); > sort @condorhash; > > Now I want to take the order of the array and apply it to the hash > while keeping the values associated wit

Sort -u emulation

2003-07-23 Thread Dan Muey
Howdy list I currently have to do this via the command line: my @unique = qx(sort -u file.txt); To remove duplicat elines from file.txt. What would be the best way to do the same thign with perl instead of calling an external program? I can always assign each element of the array to a hash

RE: a hash reference is not a hash-> lesson learned the hard way...

2003-07-23 Thread wiggins
On Wed, 23 Jul 2003 14:49:57 -0400, "West, William M" <[EMAIL PROTECTED]> wrote: > just want to share with other unwary folk the pitfalls > of making an assumption about perl (or anything for that matter) > > You are definitely correct a hash re

a hash reference is not a hash-> lesson learned the hard way...

2003-07-23 Thread West, William M
just want to share with other unwary folk the pitfalls of making an assumption about perl (or anything for that matter) i tried for the longest time to get something like the following to work:: foreach $section (keys %board){ for my $a (1..19){ for (1..19){

Re: Should I use Perl

2003-07-23 Thread Steve Grazzini
On Wed, Jul 23, 2003 at 11:39:28PM +0530, Sachin Hegde wrote: > Thanks for replyng for my bitwise query. > The reason why i need it is, coz I have to design an > application which has to parse a file which stores data > in hex. I think you probably meant "parse a binary file". Hex is just a co

Should I use Perl

2003-07-23 Thread Sachin Hegde
Hi all, Thanks for replyng for my bitwise query. The reason why i need it is, coz I have to design an application which has to parse a file which stores data in hex. Then I have to display the contents in a simple User interface. And also provide ways to change the file contents. So I thought I

Re: custom return value from entire script

2003-07-23 Thread HENRY,MARK (HP-Roseville,ex1)
Thanks guys for replying to my request for 'elp. Looks like I'll go with the 'print the value in the perl script and assign the value to a shell variable in the calling script' (thx tigger). The db record ID I want to capture contains letters, so ABC1234 is probably not a vald return value. Eith

Re: Is there a better way?

2003-07-23 Thread denis
On Tue, 22 Jul 2003, Rob Dixon wrote: > [EMAIL PROTECTED] wrote: > > I know I'm missing something here, but this code just looks to me > > like I shloud be doing it a better way.. > > > > Any ideas? > > > > > > # -N > > print "Number of Hosts? "; > > # get user input and strip off "CR-LF" > > cho

RE: hash question

2003-07-23 Thread Mike Bernhardt
Hashes don't keep your data in any knowable order- they keep it however works best for them. That's why you have to reference a value by it's key, not by it's location in the hash. -Original Message- From: awarsd [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 4:52 AM To: [EMAIL P

RE: meta refresh - PERL - IE

2003-07-23 Thread Bob Showalter
jdavis wrote: > hello, > The code below is from a cgi scrip > this code makes a html page by calling &FP > this works, i know this because i can see > Thinking. > printed in the browser right before redirect. > problem is i get the error... > > Preamautre end of script headers Your scri

RE: Reordering Hash

2003-07-23 Thread Marcos . Rebelo
maybe using the map map {print "Key is -$_- Value is $condorhash{$_} \n"} (sort(keys %condorhash)); if you need 1 array; my @a = map {$condorhash{$_}} (sort(keys %condorhash)); Marcos -Original Message- From: Dan Muey [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 4:30 PM To

RE: meta refresh - PERL - IE

2003-07-23 Thread jdavis
i do send headers and i see the refresh happening... the refresh is just to a normal html page...that also has the whole Content type: at the top... as i said before.. it works just fine with mozilla or firebird or galeon...just not IE. I have to go nowbut i will post more code when i get b

RE: Reordering Hash

2003-07-23 Thread Dan Muey
> I need to order a hash, called condorhash, based on the key > value. So what I did is: > > my @condorhash = keys(%condorhash); > sort @condorhash; > > Now I want to take the order of the array and apply it to the > hash while keeping the values associated with the key. I know > there

RE: meta refresh - PERL - IE

2003-07-23 Thread Charles K. Clarkson
jdavis <[EMAIL PROTECTED]> wrote: : : The code below is from a cgi scrip : this code makes a html page by calling &FP What is in FP()? : this works, i know this because i can see : Thinking. : printed in the browser right before redirect. : problem is i get the error... : : Preamau

Reordering Hash

2003-07-23 Thread bseel
I need to order a hash, called condorhash, based on the key value. So what I did is: my @condorhash = keys(%condorhash); sort @condorhash; Now I want to take the order of the array and apply it to the hash while keeping the values associated with the key. I know there is some way to make

RE: printing html symbols

2003-07-23 Thread Dan Muey
> Hi all, Howdy > > I need to print out a whole bunch of HTML in my cgi script. > How can I print things out with out escaping all the > necessary symbols ?? > Use single quotes, use qq(), q(), qx() etc Use here documents (you still have to escape @ signs though) print < > Mark G > > >

RE: Masking bits in variables ?

2003-07-23 Thread Kipp, James
> Hi, > Thanks for the help. > I also had another doubt how do i handle hex numbers like if > i have a > variable as $var = ff how do i get 255 , also if I and 8F > to 0F can I get > 0F ? > > sincerely > Sachin > Please always reply to the group. if your $var contains the string ff, you

Re: Masking bits in variables ?

2003-07-23 Thread Rob Dixon
On Wed, 23 Jul 2003 18:05:58 +0530, [EMAIL PROTECTED] (Sachin Hegde) wrote: >Hi, >I am new in PERL. I wanted to know how to perform bitwise operations in PERL >like masking some bits , anding oring bits. Hi Sachin. If you're new to Perl, then bitwise operations shouldn't be your first priority

printing html symbols

2003-07-23 Thread mgoland
Hi all, I need to print out a whole bunch of HTML in my cgi script. How can I print things out with out escaping all the necessary symbols ?? Mark G -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Security Code Validation for Forms

2003-07-23 Thread Dan Muey
> Hi All, I know of a service that I helped develop that uses Encryption and the Imager Module to do this. Email me off list if your interested in details of that service. Thanks, Dan > > I am trying to find a way, to place a security code image on > to a web form, so that the user, has to

RE: meta refresh - PERL - IE

2003-07-23 Thread Dan Muey
> hello, Howdy > The code below is from a cgi scrip > this code makes a html page by calling &FP > this works, i know this because i can see > Thinking. > printed in the browser right before redirect. > problem is i get the error... > > Preamautre end of script headers Did you print a

Re: Create Perl Menu

2003-07-23 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Phan Ros wrote: > Hi, I am taking perl at school. > > > > I need help to create a simple menu with input of a( current date), > b(users currently log in), c(name of working directory), and d(contents of > the working directory). Are you thinking of a simple com

RE: scope of variable carrying 'for ($n1..$n2){}'

2003-07-23 Thread Ed Christian
> -Original Message- > From: West, William M [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 23, 2003 9:21 AM > To: [EMAIL PROTECTED] > Subject: scope of variable carrying 'for ($n1..$n2){}' > > > for (1..19){ > for (1..19){ > print $_ > }} > > prints out the numbers 1 to 19 nin

scope of variable carrying 'for ($n1..$n2){}'

2003-07-23 Thread West, William M
for (1..19){ for (1..19){ print $_ }} prints out the numbers 1 to 19 nineteen times... just curious how to access the outer forloop's variable from inside willy http://www.hackswell.com/corenth -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EM

Re: Create Perl Menu

2003-07-23 Thread jdavis
On Tue, 2003-07-22 at 11:35, Phan Ros wrote: > Hi, I am taking perl at school. > > > > I need help to create a simple menu with input of a( current date), b(users > currently log in), c(name of working directory), and d(contents of the > working directory). > > > > Thanks > > > > Angko

RE: Masking bits in variables ?

2003-07-23 Thread Kipp, James
> Hi, > I am new in PERL. I wanted to know how to perform bitwise > operations in PERL > like masking some bits , anding oring bits. > > Also how to have user interfaces in Perl ? Should I use tools like TK > > Sachin Read perldoc perlop, here is a snip: -- Bitwise And Binary "&" returns

Masking bits in variables ?

2003-07-23 Thread Sachin Hegde
Hi, I am new in PERL. I wanted to know how to perform bitwise operations in PERL like masking some bits , anding oring bits. Also how to have user interfaces in Perl ? Should I use tools like TK Sachin _ Nagesh Kukunoor's back! Wi

Re: hash question

2003-07-23 Thread Todd W.
"Awarsd" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > for(1..99){ > $result{$_}=$_; > } > ##saved it in a dbm file and reopen to the file > ##when i open the file i just read all the keys and display > ## the key > . > foreach (keys %dbm){ > print "$_,"; > } > ## now the int

RE: hash question

2003-07-23 Thread Kipp, James
> > maybe someone can enlighten me(if it is possible). > I did a very simple loop/save/open/display to test hash. > > ... > ... > for(1..99){ > $result{$_}=$_; > } > ##saved it in a dbm file and reopen to the file > ##when i open the file i just read all the keys and display > ## the k

hash question

2003-07-23 Thread awarsd
Hi, maybe someone can enlighten me(if it is possible). I did a very simple loop/save/open/display to test hash. ... ... for(1..99){ $result{$_}=$_; } ##saved it in a dbm file and reopen to the file ##when i open the file i just read all the keys and display ## the key . foreach (key

Re: print command help

2003-07-23 Thread Todd W.
"Josh Corbalis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > > -- Original Message --- > From: "LI NGOK LAM" <[EMAIL PROTECTED]> > To: "Josh Corbalis" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > Sent: Wed, 23 Jul 2003 02:52:16 +0800 > Subject: Re: print command

RE: Create Perl Menu

2003-07-23 Thread Vidal, Christopher, SOLCM
I too am trying to learn perl and its very hard to get answers to topics you dont understand. I can lead you in the right direction just as long as you dont want gui output ... Theres probably a better way then this ... however .. 1. use the print (or better yet printf) command to print out t

Re: uploading from network

2003-07-23 Thread Sri
if you have to first see if the ftp below works: $ftp eg. say the ip address is some 148.87.36.11 $ ftp 148.87.36.11 $ put file $ bye. sri. "Saurabh Singhvi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > hi all > i am in a local net and we use a netmon proxy , so if > i hav t

Re: News Group - Mailing List

2003-07-23 Thread Jose Maria Mateos
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 In perl.beginners, Paul ([EMAIL PROTECTED]) wrote: > I notice my messages sometimes take 6 or more hours to appear. As well as > everyone elses. Its as if I am a day behind all the time. Perhaps it's due to the message having to be approved b

Re: ANNOUNCE: Ncurses programming examples

2003-07-23 Thread Anuradha Ratnaweera
On Tue, Jul 22, 2003 at 08:35:23PM +0600, Anuradha Ratnaweera wrote: > > Some examples from ncurses programming howto have been ported from C to > Perl. Downloads are at http://www.linux.lk/anuradha/. There is a typo in the URL. The correct one is http://www.linux.lk/~anuradha/. Anurad