RE: Perl Beginner

2006-07-15 Thread Jeff Peng
I think 'Learning Perl' is the better choice.Here is the book's info: Learning Perl, 3rd Edition By Tom Phoenix, Randal L. Schwartz Publisher: O'Reilly Pub Date: July 2001 ISBN: 0-596-00132-0 Pages : 330 Currently the 4rd Edition is published. From: "Brian Franco" <[EMAIL PROTECTED]> To:

Perl Beginner

2006-07-15 Thread Brian Franco
Hello all, This is my first post to the list. I just started studying Perl I was just wondering if anyone has read the book: Perl programming for the absolute beginner By Author Jerry Lee Ford Jr. ? This is the book im reading to study Perl Just wondering how others found the book to be

Re: math formula substitution and evaluation

2006-07-15 Thread John W. Krahn
Rob Dixon wrote: > > You can do exactly that in Perl, and a lot more simply: > > my @variables = (3, 7, 13, 4, 12); > my @tests = ("2*a+b==c", "c-d+a==e"); > > foreach (@tests) { > s/([a-z])/$variables[ord($1) - ord('a')]/ge; You don't need the /e option there. (Try it if you don't b

Re: math formula substitution and evaluation

2006-07-15 Thread Aaron Priven
On Jul 15, 2006, at 5:15 PM, Daniel D Jones wrote: Given something like the following: my @variables = [3, 7, 13, 4, 12]; As an aside, you meant parentheses here, not brackets. (Brackets return a reference to an anonymous array containing the list, not the list itself.) my @tests = ("2

Re: math formula substitution and evaluation

2006-07-15 Thread Rob Dixon
Daniel D Jones wrote: > Given something like the following: > > my @variables = [3, 7, 13, 4, 12]; You want round brackets here. You've created an array with just one element, with a reference to an anonymous array as its value. > my @tests = ("2*a+b==c", "c-d+a==e"); > > I need to be able to

Re: How to write output in an xml file

2006-07-15 Thread Rob Dixon
Suja Emmanuel wrote: > Hi Rob, > > Thanks for you logic. I will explain what I am doing and what I > expect. > I have written a code to hit a particular URL from my code and > the code will return the rawdata. Now the rawdata itself is an XML file > and I want to optn the XML file in internet

Re: math formula substitution and evaluation

2006-07-15 Thread Tom Phoenix
On 7/15/06, Daniel D Jones <[EMAIL PROTECTED]> wrote: my @variables = [3, 7, 13, 4, 12]; my @tests = ("2*a+b==c", "c-d+a==e"); I need to be able to evaluate the mathematical truth of the tests, May I suggest Parse::RecDescent? If you can make a grammar out of your algebra, you'll have an easy

math formula substitution and evaluation

2006-07-15 Thread Daniel D Jones
Given something like the following: my @variables = [3, 7, 13, 4, 12]; my @tests = ("2*a+b==c", "c-d+a==e"); I need to be able to evaluate the mathematical truth of the tests, using the values from @variables, where $variable[0] holds the value of the variable 'a', $variables[1] holds the value

Re: Help with Stupid question

2006-07-15 Thread Tom Phoenix
On 7/15/06, Ralph H. Stoos Jr. <[EMAIL PROTECTED]> wrote: I want to know if / how the $buf/25400 part can be formatted to be a number with only two or three decimal places. In Perl, that kind of formatting is generally done with printf or its related function sprintf. Where sprintf is a functi

Help with Stupid question

2006-07-15 Thread Ralph H. Stoos Jr.
All, Believe it or not, I looked in the three Perl books I own and could not find out how to do this. My guess is that it is simple and probably the folks that wrote the three books took it for granted. Here goes, My code is this: print "Do you wish to exclude ", $buf/25400, " from the output?

Re: strip

2006-07-15 Thread Dr.Ruud
"WCJ d/b/a http://ccsh.us/"; schreef: > Rob Dixon: >> John W. Krahn: >>> s/_.*\././; >> >> Sometimes Perl regexes start to look like ASCII art! > > Thats why this format would be easier on the eyes: > > s|_.*\.|.|; Variants: s| _ .* [.] |.|x s! _ .* [.] !.!x s{ _ .* [.] }{.}x -- Affijn

Re: How to write output in an xml file

2006-07-15 Thread Todd W
""Suja Emmanuel"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have written a code to hit a particular URL from my code and > the code will return the rawdata. Now the rawdata itself is an XML file > and I want to optn the XML file in internet explorer. > > The script which I

Re: how to add a list of numbers

2006-07-15 Thread WCJ d/b/a http://ccsh.us/
On 7/15/06, I BioKid <[EMAIL PROTECTED]> wrote: is there any shortest way to add a list of random numbers ? for example : 11 1 250 39 100 my $results; while(){ s|\s+||g; $results += $_; } print $results; __END__ 11 2 250 39 -- WC (Bill) Jones -- http://youve-reached-the.endoftheinterne

Re: strip

2006-07-15 Thread WCJ d/b/a http://ccsh.us/
On 7/14/06, Rob Dixon <[EMAIL PROTECTED]> wrote: John W. Krahn wrote: > > s/_.*\././; Sometimes Perl regexes start to look like ASCII art! Thats why this format would be easier on the eyes: s|_.*\.|.|; -- WC (Bill) Jones -- http://youve-reached-the.endoftheinternet.org/ -- To unsubscribe, e

Re: Perl One-Liners

2006-07-15 Thread Dr.Ruud
Prabu schreef: > To print line other than 5th one > perl -ne 'print "$_" if $. != 5' filename I would make that perl -wne 'print qq{$_} if $. != 5' filename or perl -wne 'print if $. != 5' filename or better perl -wne 'print unless $. == 5' filename or maybe even perl -wne '$.

Re: Perl One-Liners

2006-07-15 Thread Prabu
Dr.Ruud wrote: Chandru schreef: Prabu: I am a perl user as well as i works on some sed scripts.I am also a subscriber of "sed-users".In that list,people maintain the sed one-liners in the name. "HANDY ONE-LINERS FOR SED" People in the list will get a mail regularly with the one-

Re: HANDY PERL ONE-LINERS

2006-07-15 Thread Peter Scott
On Sat, 15 Jul 2006 12:09:50 +0530, Prabu wrote: > People in the list will get a mail regularly with the one-liners in the > name.We can also maintain some perl-one liners in our list and someone > good in perl can contribute to the one-liner and this can be send to the > list regularly("HANDY PERL

Perl One-Liners (was: Re: HANDY PERL ONE-LINERS)

2006-07-15 Thread Dr.Ruud
Chandru schreef: > Prabu: >> I am a perl user as well as i works on some sed scripts.I am also a >> subscriber of "sed-users".In that list,people maintain the sed >> one-liners in the name. >> >> "HANDY ONE-LINERS FOR SED" >> >> People in the list will get a mail regularly with the one-liners in

Re: strip

2006-07-15 Thread Dr.Ruud
Rob Dixon schreef: > John W. Krahn: >> s/_.*\././; > > Sometimes Perl regexes start to look like ASCII art! It is a BRE, so far older than Perl. :) -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: how to add a list of numbers

2006-07-15 Thread Jeff Peng
Hello,how about this? use strict; my $maxLenth=16; my @a = (0..99); my @randList = map { $a[int rand @a] } 0..($maxLenth-1); print "@randList\n"; Here $maxLenth is the list's length,@a is the source where the list members coming from. is there any shortest way to add a list of random num