Re: The True Guide to Learning Perl was Re: Thank You! :)

2002-07-16 Thread Connie Chan
Hi everybody, I don't understand why you guys making things so complex. "Perl is language" and I think that should be all. :-) Whatever the habbits on Perl, is just as simple as how we learn our mother tongue. On the learning side, we began with A, B, C , while on the practical side, we b

Re: Books on "Network programming in Perl"...

2002-07-16 Thread John W. Krahn
Parag Dhake wrote: > > Hi Everybody, Hello, >I'm new to this mailing list (and to the world of > Perl, as well) Would appreciate if you can suggest me > some good books on "Network programming in Perl". http://www.awprofessional.com/catalog/product.asp?product_id={CF32E8D7-BEC2-4445-8B3E-9

Re: Consolidate if/else

2002-07-16 Thread Connie Chan
"Surround them"... and ... better use +ve logic : $opt_Z ? ( $mkt = $opt_Z) : ( die "Must supply Market\n" ); or $opt_Z ? { $mkt = $opt_Z} : { die "Must supply Market\n" }; Rgds, Connie - Original Message - From: "Kevin Old" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday,

Re: Books on "Network programming in Perl"...

2002-07-16 Thread Tyler Longren
yes, perl can be used on NT and other windows variants. On Wed, 17 Jul 2002 08:48:12 +0530 "Parag Dhake" <[EMAIL PROTECTED]> wrote: > > Hi Everybody, > >I'm new to this mailing list (and to the world of Perl, as well) >Would appreciate if you can suggest me some good books on "Network

Re: Can get script to print to command prompt no matter what I try

2002-07-16 Thread Shawn
Hey Cory, This is a screen shot from my command prompt, is this what you are doing character for character? Microsoft Windows 2000 [Version 5.00.2195] (C) Copyright 1985-1999 Microsoft Corp. C:\>perl -e "print qq~Hello\n~" Hello C:\>perl -v This is perl, v5.6.1 built for MSWin32-x86-multi-

Re: Can get script to print to command prompt no matter what I try

2002-07-16 Thread Connie Chan
Try the simplest : # C:\test.pl # print "hello world!\n"; ## At Dos prompt of C:\> type : perl test.pl Rgds, Connie - Original Message - From: "cory" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 17, 2002 11:19 AM Subject: Can get script t

Books on "Network programming in Perl"...

2002-07-16 Thread Parag Dhake
Hi Everybody, I'm new to this mailing list (and to the world of Perl, as well) Would appreciate if you can suggest me some good books on "Network programming in Perl". Do you think Perl is the best language for network programming ?. If no, please tell me, which other language is best

Re: find biggest number (new try :) )

2002-07-16 Thread Connie Chan
@array = sort {$a <=> $b} @array; $biggest = pop(@array); - Original Message - From: "Konrad Foerstner" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 17, 2002 12:42 AM Subject: find biggest number (new try :) ) > > sorry a small but important mistake > > Im looki

Can get script to print to command prompt no matter what I try

2002-07-16 Thread cory
I have tried numerous variations of this simple script: print ("hello\n"); perl -e "print qq~Hello\n~" C:\> perl print "Hello\n"; then press 'controll Z' print "hello"; and press 'control C' Nothing works. I can run a pre written script, but that is it. I have the camel book and none of t

Re: " does not display in html

2002-07-16 Thread Wiggins d'Anconia
You need to "escape" the double quote character as it ends the value prematurely. I believe you want to run a regex to change the value: $p_name =~ s/"/"/g That would fix a display and I *believe* it will work for form inputs as well. Form inputs are funny that way though. http://danconia.org

Re: xml and mysql question...

2002-07-16 Thread Wiggins d'Anconia
Below is a mysql approach using DBD::Mysql which can be generalized to DBI pretty easily. #!/usr/bin/perl use Mysql; # connect if (!($dbh=Mysql->connect('localhost',''))) {print "Connect error. Please try back later.";exit;} #sample query $statement="SELECT id,name,location,setting FROM users

xml and mysql question...

2002-07-16 Thread WyvernGod
Hey im thinking of doing some perl stuff with xml.. but I have no experiance in it.. a friends site offers their news links in xml format.. what I need to do is to open a connection to there site.. read that file then display it on my own site. any ideas one working with xml? Also can someon

" does not display in html

2002-07-16 Thread Yuan Cheng
Hi, All: I encounted one situation which seems wield to me. I retrieved a set of data from mySQL database and try to diplay in a html form. I found that one field with the string which has " in it cannot be displayed properly. the code is as follows: #retrieve the data from Table order_recor

Can print to command line

2002-07-16 Thread cory
Tim, That fixed it. But I still can't make a simple script like: print ("Hello\n"); print to the command line. Here is what I do: C:\>perl print ("Hello\n"); I hit enter and nothing. what am I doing wrong? Cory Moore Campaign Manager Pat Ahumada for Congress www.patforcongress.com www.america

Re: Pert to test web server is alive

2002-07-16 Thread Wiggins d'Anconia
While well done, and maybe necessary on a windows boxen, this might be major overkill for someone running a *nix box to do the testing. Also depends on what you want to do with the "results" of the test. For someone with access using "cron" with a utility like "curl" might be easier/faster. F

Re: Retrieving Data from a Db using Perl

2002-07-16 Thread Wiggins d'Anconia
Don't forget the "WHERE" clause in your select statement, and rather than selecting "*" why not ONLY select the email field. And the example is connecting to an Oracle DB not an Intersolv DB, unless they are the same (sorry I am not familar with Intersolv). *If* you are only looking to do a s

Compiling Perl Source

2002-07-16 Thread pitr
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi List users, Newbie online trying to compile perl 5.6.1 on Redhat 6.2. I get the following error. perl: warning: Falling back to the standard locale ("C"). perl: warning: Setting locale failed. perl: warning: Please check that your locale setting

Re: setting permissions in open

2002-07-16 Thread Wiggins d'Anconia
Ah, umask. Forgot that one as I rarely change it on my own servers, and naturally set it in my profile at the shell. Thanks for the hints about IO::File, I will check it out, though using the regular open followed by a chmod seems to be holding up under fire. http://danconia.org Michael F

RE: Can't spawn cmd.exe

2002-07-16 Thread Timothy Johnson
D:\perl\bin must be in your path to find perl.exe, but if you don't have cmd.exe in your path then there are a lot of other things that can break, most notably batch files. All of the perldocs are made using perl2bat batch files, so you must be able to see cmd.exe. Also, I think you might be mi

RE: Can't spawn cmd.exe

2002-07-16 Thread Timothy Johnson
Actually, yes, that could cause a lot of problems if cmd.exe is not in your path. Check your path variable. Do you have %system%\system32 in there? If not, then it might be time to add it and possibly get rid of some things in there if you know that you can safely remove them, such as entries a

Can't spawn cmd.exe

2002-07-16 Thread cory
When I type perldoc perl at the command prompt I get the following: Can't spawn "cmd.exe": No such file or directory at D:\Perl\bin\PERLDOC.bat line 395 Is this why I can not get perl to work Cory Moore Campaign Manager Pat Ahumada for Congress www.patforcongress.com www.americanvirtue.com

Re: Shift

2002-07-16 Thread Ian Harisay
THat depends on the context of its use. in a subroutine this would take the first element from @_. >>> "Adriano Sastre Vieira" <[EMAIL PROTECTED]> 07/16/02 10:54AM >>> What does the following instruction means? That is, when my variable receives shift, what is it? my $MENUI = shift; Thanks

RE: Consolidate if/else

2002-07-16 Thread Shishir K. Singh
Better use defined on $opt_Z , cause it will die even if $opt_Z has 0 , '0' or space !! > > Hello all, > > I'm trying to get this line to work > > (!$opt_Z) ? die "Must supply Market\n" : $mkt = $opt_Z; >You need parens because assignment is lower precedence than ternary: > > (!$opt_Z) ?

RE: Consolidate if/else

2002-07-16 Thread Jeff 'japhy' Pinyan
On Jul 16, Bob Showalter said: > $mkt = $opt_Z or die "Must supply Market\n"; > >(n.b. "or" is needed instead of "||", since it has super low precedence) Well, it's not important here, since die() will end the process. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~

Re: Consolidate if/else

2002-07-16 Thread Jeremy Vinding
> (!$opt_Z) ? die "Must supply Market\n" : $mkt = $opt_Z; $mkt = $opt_Z || die "Must supply Market\n"; jjv -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Consolidate if/else

2002-07-16 Thread Tanton Gibbs
That's also kind of obfuscated...you might try die "Must supply Market\n" unless $mkt = $opt_Z; - Original Message - From: "Kevin Old" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 16, 2002 4:54 PM Subject: Consolidate if/else > > Hello all, > > I'm trying to get t

RE: Consolidate if/else

2002-07-16 Thread Bob Showalter
> -Original Message- > From: Kevin Old [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 4:54 PM > To: [EMAIL PROTECTED] > Subject: Consolidate if/else > > > > Hello all, > > I'm trying to get this line to work > > (!$opt_Z) ? die "Must supply Market\n" : $mkt = $opt_Z; You

Re: Consolidate if/else

2002-07-16 Thread Jeff 'japhy' Pinyan
On Jul 16, Kevin Old said: >I'm trying to get this line to work > >(!$opt_Z) ? die "Must supply Market\n" : $mkt = $opt_Z; > >and I keep getting compiler errors. You should reproduce the error so we don't have to, but I know the error already. Something like "cannot modify die in assignment"?

Re: word count (limit) in a scalar...

2002-07-16 Thread John W. Krahn
"Anthony E." wrote: > > hello, Hello, > i have a bunch of text in a scalar $text > How would I keep the word count to a maximum, and just > dump the rest.. ie - I only want the paragraph to > contain 500 words, and trash the rest. my $new_text = join '', ($text =~ /(\s*\S+)/g)[0..499]; John

RE: Consolidate if/else

2002-07-16 Thread Nikola Janceski
precedence.. ?: has lower precedence than {} change it to: (!$opt_Z) ? die("Must supply Market\n") : $mkt = $opt_Z; > -Original Message- > From: Kevin Old [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 4:54 PM > To: [EMAIL PROTECTED] > Subject: Consolidate if/else > > >

RE: Consolidate if/else

2002-07-16 Thread Shishir K. Singh
>Hello all, >I'm trying to get this line to work >(!$opt_Z) ? die "Must supply Market\n" : $mkt = $opt_Z; >and I keep getting compiler errors. $mkt = (defined ($opt_Z)) ? $opt_Z : die("Must supply Market\n"); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [E

RE: Consolidate if/else

2002-07-16 Thread Timothy Johnson
Turn on warnings and use strict, and let us know what your errors are. -Original Message- From: Kevin Old [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 1:54 PM To: [EMAIL PROTECTED] Subject: Consolidate if/else Hello all, I'm trying to get this line to work (!$opt_Z) ? di

Consolidate if/else

2002-07-16 Thread Kevin Old
Hello all, I'm trying to get this line to work (!$opt_Z) ? die "Must supply Market\n" : $mkt = $opt_Z; and I keep getting compiler errors. Basically I'm trying to consolidate: if (!$opt_Z) { die "Must supply Market\n"; } else { $mkt = $opt_Z; } Any ideas? Thanks, Kevin

Re: Strange tie Problem

2002-07-16 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > > The following snippet is from "Advanced perl programming" by Sriram > Srinivasan. A test program is also attached. > If I print any other list element, it works fine but for > the first element ( $array[1] ), it gives a warning. What's on?? > Perl version is 5.6.0 on

RE: word count (limit) in a scalar...

2002-07-16 Thread Nikola Janceski
why does this idea sound like it's coming from: A. a student who hopes to have computer program write his 500 word essays every week. B. a teacher who put the rule on students that s/he will ignore anything beyond 500 words. :) > -Original Message- > From: Daniel Gardner [mailto:[EMAIL

Re: The True Guide to Learning Perl was Re: Thank You! :)

2002-07-16 Thread drieux
On Tuesday, July 16, 2002, at 12:21 , John W. Krahn wrote: > Drieux wrote: >> >> f) Visit the ActiveState Folks, and Source Forge, look at how >> they are solving problems. Decide which of them are useful >> solutions, by demonstration. > > I don't know that I would trust any Per

Re: word count (limit) in a scalar...

2002-07-16 Thread Daniel Gardner
Anthony E. wrote: > i have a bunch of text in a scalar $text > How would I keep the word count to a maximum, and just > dump the rest.. ie - I only want the paragraph to > contain 500 words, and trash the rest. I know this isn't exaclty what you asked... I'm taking a wild guess and thinking tha

Re: word count (limit) in a scalar...

2002-07-16 Thread Mike(mickalo)Blezien
On Tue, 16 Jul 2002 12:14:21 -0700 (PDT), "Anthony E." <[EMAIL PROTECTED]> wrote: >>i have a bunch of text in a scalar $text >>How would I keep the word count to a maximum, and just >>dump the rest.. ie - I only want the paragraph to >>contain 500 words, and trash the rest. my $text = "some real

Re: Perl constants with modules

2002-07-16 Thread Daniel Gardner
Kevin Old wrote: > I am writing a script for a client and they have requested an easy way > to configure their script.without having to enter the script code > itself. > Second, which sytax (in your opinion) should I use? > > $CDMA::USER = "myusername"; > > or > > use constant USER => "

Re: word count (limit) in a scalar...

2002-07-16 Thread Chas Owens
On Tue, 2002-07-16 at 15:14, Anthony E. wrote: > hello, > > i have a bunch of text in a scalar $text > How would I keep the word count to a maximum, and just > dump the rest.. ie - I only want the paragraph to > contain 500 words, and trash the rest. > > Thanks, > Anthony ASSUMPTIONS:

Re: The True Guide to Learning Perl was Re: Thank You! :)

2002-07-16 Thread drieux
On Tuesday, July 16, 2002, at 11:36 , Peter Scott wrote: [..] > There's always http://search.cpan.org/doc/KSTAR/B-Fathom-0.07/Fathom.pm > > :-) Is it just me, or if they had followed the instructions that I outlined they would have noticed the need to have a simple solutions for addressing 'curr

Re: The True Guide to Learning Perl was Re: Thank You! :)

2002-07-16 Thread John W. Krahn
Drieux wrote: > > f) Visit the ActiveState Folks, and Source Forge, look at how > they are solving problems. Decide which of them are useful > solutions, by demonstration. I don't know that I would trust any Perl code at Source Forge. I've looked at some of the Perl projects the

Re: find biggest number

2002-07-16 Thread George Schlossnagle
>> sorting has a best expected runtime of O(nlog(n)), finding the max item >> via a linear search is O(n). > > This should really be in the FAQ, but here we go again. This is why big > O notation only tells you half the story. Sort is implemented in C and > is one operation as far as Perl is con

word count (limit) in a scalar...

2002-07-16 Thread Anthony E.
hello, i have a bunch of text in a scalar $text How would I keep the word count to a maximum, and just dump the rest.. ie - I only want the paragraph to contain 500 words, and trash the rest. Thanks, Anthony __ Do You Yahoo!? Yahoo! Autos - Get fr

Re: The True Guide to Learning Perl was Re: Thank You! :)

2002-07-16 Thread Peter Scott
At 01:57 PM 7/16/02 -0400, Chas Owens wrote: >Well, I have heard there is a programing language named Perl that is >good at processing text. Maybe we could write a script that would >download this code (I have heard there is a module for Perl that lets >you do this; it is called CPAN), then we co

Re: Shift

2002-07-16 Thread Jeff 'japhy' Pinyan
On Jul 16, Adriano Sastre Vieira said: >What does the following instruction means? That is, when my variable >receives shift, what is it? > > my $MENUI = shift; shift() is explained here: perldoc -f shift shift() with no args either looks at @_ (if you're in a subroutine) or @ARGV (if you a

RE: Shift

2002-07-16 Thread Timothy Johnson
It means that your script is removing the first element from the @_ array and assigning it to your variable. Usually you will see this at the beginning of a subroutine when variables have been passed to it, since all variablesa passed to a sub are put into the @_ array. -Original Message---

RE: Shift

2002-07-16 Thread Daryl J. Hoyt
It returns the first value of an array and then increments the index. Daryl J. Hoyt Software Engineer Geodesic Systems 312-832-2010 < http://www.geodesic.com> < mailto:[EMAIL PROTECTED]> -Original Message- From: Adriano Sastre Vieira [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16,

Re: Shift

2002-07-16 Thread Michael A Chase
On Tue, 16 Jul 2002 13:54:14 -0300 Adriano Sastre Vieira <[EMAIL PROTECTED]> wrote: > What does the following instruction means? That is, when my variable > receives shift, what is it? > > my $MENUI = shift; It's in the fine manual: perldoc -f shift -- Mac :}) ** I normally forward privat

Shift

2002-07-16 Thread Adriano Sastre Vieira
What does the following instruction means? That is, when my variable receives shift, what is it? my $MENUI = shift; Thanks :-) - Adriano Sastre Vieira Especialista em Sistemas Inatel Competence Center +55 35 3471 9335 http://www.inatel.br

Re: The True Guide to Learning Perl was Re: Thank You! :)

2002-07-16 Thread Chas Owens
I'm afraid this [downloading and reading/understanding every module on CPAN] is not doable. The modules are a moving target, before you could review them all there'll be new ones and the old ones will be extended :-) Well, I have heard there is a programing language named Perl that is good at

Re: find biggest number

2002-07-16 Thread Chas Owens
On Tue, 2002-07-16 at 12:58, George Schlossnagle wrote: > > On Tuesday, July 16, 2002, at 12:48 PM, Shishir K. Singh wrote: > > > Why not use sort on the array and get the last element which would be > > the highest?? > > > > my @sorted = sort @list; > > my $max = $sort[$#sorted]; > > > > Would

RE: find biggest number (new try :) )

2002-07-16 Thread Timothy Johnson
There's More Than One Way To Do It(tm) #1 $max = ''; foreach(@array){ if($_ > $max){ $max = $_; } } #2 @array = sort{$a <=> $b}@array; $max = $array[-1]; -Original Message- From: Peter Scott [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 10:17 AM To: Konrad Foerstner;

RE: The True Guide to Learning Perl was Re: Thank You! :)

2002-07-16 Thread Nikola Janceski
> -Original Message- > From: drieux [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 1:25 PM > > But we do have an ethical obligation to beginner's to make > them aware that there is: > > the right way what happened to 'the best way' 'the readable way'? > the wrong w

RE: Perl constants with modules

2002-07-16 Thread Jeff 'japhy' Pinyan
On Jul 16, Kevin Old said: >Do you have any code for processing a config file and/or an example >config file? There are plenty of config-file modules on CPAN. Search for "config" at http://search.cpan.org/. >%mar_omc_and_mms = ( > 'clt' => { 'omc2' => [qw(mm3 mm4)] }, > 'clt1x' => { 'omc1' =

Re: The True Guide to Learning Perl was Re: Thank You! :)

2002-07-16 Thread drieux
On Tuesday, July 16, 2002, at 09:47 , Jenda Krynicky wrote: [..] While I normally would defer to Jenda, who's Perl Mojo is demonstrably Very Strong, I fear that Jenda has given in to the 'dark side'. > I'm afraid this is not doable. The modules are a moving target, > before you could review

Resorting to Sorting (doc)

2002-07-16 Thread Jeff 'japhy' Pinyan
URL: http://www.pobox.com/~japhy/docs/sorting.html NAME Resorting to Sorting SYNOPSIS A guide to using Perl's `sort()' function to sort data in numerous ways. Topics covered include the Orcish maneuver, the Schwartzian Transform, the Guttman-Rosler Transform, radix sort, and sort

Re: find biggest number (new try :) )

2002-07-16 Thread Peter Scott
At 06:42 PM 7/16/02 +0200, Konrad Foerstner wrote: >sorry a small but important mistake > >Im looking for a method to extract the >biggest element (number) out of array. >Does anyone know a function for that? use List::Util qw(max); print max(@input); -- Peter Scott Pacific Systems Design Techn

Re: how to split a perl program on multiple files?

2002-07-16 Thread Peter Scott
At 04:18 PM 7/16/02 +0200, Martin A. Hansen wrote: >for the sake of order and logic, i want to split my perl script into >two files. > >what is the smart way to do this? perl -nle 'BEGIN{$f=$ARGV[0];open $fh[$_],">$f.$_" for 1..2}print {$fh[1]} substr $_,0,length()/2; print {$fh[2]} substr $_,l

Re: find biggest number

2002-07-16 Thread Jeff 'japhy' Pinyan
[Please do not top-post -- it makes the conversation difficult to follow] On Jul 16, Konrad Foerstner said: >On Tue, 16 Jul 2002 12:48:55 -0400 >"Shishir K. Singh" <[EMAIL PROTECTED]> wrote: > >> my @sorted = sort @list; >> my $max = $sort[$#sorted]; >> >> Wouldn't this work ? I a not sure about

RE: Perl constants with modules

2002-07-16 Thread Kevin Old
Nikola, Do you have any code for processing a config file and/or an example config file? Here's a hash that I think is tough to transalte into a config file: %mar_omc_and_mms = ( 'clt' => { 'omc2' => [qw(mm3 mm4)] }, 'clt1x' => { 'omc1' => [qw(mm101 mm102)],

RE: find biggest number

2002-07-16 Thread Kipp, James
> > Seems this has already been proposed by Nikola!! I like this > approach as it's in the spirit of Perl and a one liner :)!! > > > Why not use sort on the array and get the last element > which would be the highest?? > > > my @sorted = sort @list; > > my @sorted = sort > > my $max = $sort

Re: find biggest number

2002-07-16 Thread George Schlossnagle
On Tuesday, July 16, 2002, at 12:48 PM, Shishir K. Singh wrote: > Why not use sort on the array and get the last element which would be > the highest?? > > my @sorted = sort @list; > my $max = $sort[$#sorted]; > > Wouldn't this work ? I a not sure about the speed though!! sorting has a best ex

Re: find biggest number

2002-07-16 Thread Konrad Foerstner
Yes, thanks. I think this is the easiest way! On Tue, 16 Jul 2002 12:48:55 -0400 "Shishir K. Singh" <[EMAIL PROTECTED]> wrote: > Why not use sort on the array and get the last element which would be the highest?? > > my @sorted = sort @list; > my $max = $sort[$#sorted]; > > Wouldn't this

RE: find biggest number

2002-07-16 Thread Shishir K. Singh
Seems this has already been proposed by Nikola!! I like this approach as it's in the spirit of Perl and a one liner :)!! > Why not use sort on the array and get the last element which would be the highest?? > my @sorted = sort @list; > my @sorted = sort > my $max = $sorted[$#sorted]; > Would

RE: find biggest number

2002-07-16 Thread Shishir K. Singh
Why not use sort on the array and get the last element which would be the highest?? my @sorted = sort @list; my $max = $sort[$#sorted]; Wouldn't this work ? I a not sure about the speed though!! >Here is a routing that i use: -- > @nums = (5,6,3,7,2,9,12,46); >$rv = min(\@nums); > print "$r

Re: The True Guide to Learning Perl was Re: Thank You! :)

2002-07-16 Thread Jenda Krynicky
From: drieux <[EMAIL PROTECTED]> > On Tuesday, July 16, 2002, at 08:46 , Timothy Johnson wrote: > > > I have a few suggestions. > [..] > > While I basically agree with most of timothy's thrust, > I would argue the case slightly differently: > > a) the outside world is full of beast creatures a

RE: Working with hashes...

2002-07-16 Thread Jeff 'japhy' Pinyan
On Jul 16, Shishir K. Singh said: >>while($db->FetchRow()){ >>%Data = $db->DataHash(First_Name,Last_Name); >> foreach $key (sort(keys %Data)) { >>print $key, '=', $Data{$key}, "\n"; >> } # end foreach >>print("\n"); >>} > >Just curious. I assume that you are using DBI module

RE: find biggest number

2002-07-16 Thread Kipp, James
Here is a routing that i use: -- @nums = (5,6,3,7,2,9,12,46); $rv = min(\@nums); print "$rv\n"; sub min { my($num) = @_; my ($max) = shift @$num; foreach $i (@$num) { $max = $i if $max < $i; } return($max); } > -Original Message- >

find biggest number (new try :) )

2002-07-16 Thread Konrad Foerstner
sorry a small but important mistake Im looking for a method to extract the biggest element (number) out of array. Does anyone know a function for that? cu Konrad -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: find biggest number

2002-07-16 Thread Jeff 'japhy' Pinyan
On Jul 16, Konrad Foerstner said: >Im looking for a method to exact the >biggest element (number) out of array. >Does anyone know a function for that? Go through the array and stop when you've found the biggest number. ;) No, honestly, you go through the array, and compare the current element w

Re: find biggest number

2002-07-16 Thread drieux
On Tuesday, July 16, 2002, at 09:38 , Konrad Foerstner wrote: > Hi, > > Im looking for a method to exact the > biggest element (number) out of array. > Does anyone know a function for that? do you mean something like my $max= -99; for (@array) { $max = $_

RE: Working with hashes...

2002-07-16 Thread Shishir K. Singh
>I know this has been covered before, so a faq pointer is ok w/me. >I have this code: >while($db->FetchRow()){ >%Data = $db->DataHash(First_Name,Last_Name); > foreach $key (sort(keys %Data)) { > print $key, '=', $Data{$key}, "\n"; > } # end foreach > print("\n"); >} Just

RE: find biggest number

2002-07-16 Thread Nikola Janceski
$largest = (sort { $b <=> $a } @array)[0] > -Original Message- > From: Konrad Foerstner [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 12:38 PM > To: [EMAIL PROTECTED] > Subject: find biggest number > > > Hi, > > Im looking for a method to exact the > biggest element (number

find biggest number

2002-07-16 Thread Konrad Foerstner
Hi, Im looking for a method to exact the biggest element (number) out of array. Does anyone know a function for that? cu Konrad -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Working with hashes...

2002-07-16 Thread Jeff 'japhy' Pinyan
On Jul 16, Powell, Ron said: >while($db->FetchRow()){ > %Data = $db->DataHash(First_Name,Last_Name); > foreach $key (sort(keys %Data)) { >print $key, '=', $Data{$key}, "\n"; > } > print("\n"); >} > >Now, what appears to be happening is that only one row at a time is >being processed and t

The True Guide to Learning Perl was Re: Thank You! :)

2002-07-16 Thread drieux
On Tuesday, July 16, 2002, at 08:46 , Timothy Johnson wrote: > I have a few suggestions. [..] While I basically agree with most of timothy's thrust, I would argue the case slightly differently: a) the outside world is full of beast creatures and demons with BIG FANGS an

Working with hashes...

2002-07-16 Thread Powell, Ron
I know this has been covered before, so a faq pointer is ok w/me. I have this code: while($db->FetchRow()){ %Data = $db->DataHash(First_Name,Last_Name); foreach $key (sort(keys %Data)) { print $key, '=', $Data{$key}, "\n"; } # end foreach print("\n"); } Now, what app

Re: Perl constants with modules

2002-07-16 Thread Mike(mickalo)Blezien
Kevin, I have found, with experience, with clients who need to have scripts written, that are going to need some sort of global variables assigned to be used by various script, to use a separate configuration file or module. This prevents the client from messing up the main script(s) for your pro

RE: Still Can't get perl to work on Win2K Pro PC

2002-07-16 Thread Timothy Johnson
If you want to see what your script is outputting when you double-click on the icon, you will a) need a longer script, or b) need to put a line like ";", which will make the script wait for input, or "sleep 5;", which will make it wait for 5 seconds after it is done. Otherwise your perl install

RE: Perl constants with modules

2002-07-16 Thread Jeff 'japhy' Pinyan
On Jul 16, Michael Pastore said: >$Split1 = "@ARGV[2]"; >$Split2 = "@ARGV[3]"; >$WorkPath = "@ARGV[4]"; >$DataPath = "@ARGV[5]"; Useless use of quotes on @ARGV[2]. Scalar value @ARGV[2] better written as $ARGV[2]. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/

Re: Perl constants with modules

2002-07-16 Thread Jeff 'japhy' Pinyan
On Jul 16, Kevin Old said: >$CDMA::USER = "myusername"; vs. >use constant USER => "myusername"; >(called like CDMA::USER.correct?) Well, it's really quite a trifle. I would stick with variables (as opposed to constants) unless you REALLY need the benefit of a constant. -- Jeff "japhy" P

RE: Perl constants with modules

2002-07-16 Thread Nikola Janceski
I still think you are safer with a config file. With a module they can screw up the script so when it fails they will be calling you. with a config file you can program in the error checking. > -Original Message- > From: Kevin Old [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002

RE: Perl constants with modules

2002-07-16 Thread Michael Pastore
Kevin, You could consider using input parameters as well... $Split1 = "@ARGV[2]"; $Split2 = "@ARGV[3]"; $WorkPath = "@ARGV[4]"; $DataPath = "@ARGV[5]"; so that when running from the command line they would be passed after the ..pl HTH, Mike -- To unsubscribe, e-mail: [EMAIL PROTECTED] For ad

Perl constants with modules

2002-07-16 Thread Kevin Old
Hello all, I am writing a script for a client and they have requested an easy way to configure their script.without having to enter the script code itself. I'm not to crazy about using a config file like VARIABLE=VALUE, so I thought that since I am using a module anyway, why not have the v

RE: Thank You! :)

2002-07-16 Thread Timothy Johnson
I have a few suggestions. 1. Practice. 2. Practice. 3. Find useful things to do with Perl, and you'll learn alot faster than coming up with arbitrary scripts. 4. Take a break before you pull that last hair out of your head. 5. Practice. 6. use strict; at the top of your scripts 7. use warnings;

RE: Can't Get Perl to Work on Win2K PC

2002-07-16 Thread John Wunderly
>> To make the changes to the path permanent, go start, settings, system, >> advanced, environment variables and add to the PATH. >Why not "Start" -> "Run" -> notepad c:\autoexec.bat > :- ) W2k doesn't have to have an AUTOEXEC.BAT. The settings change method above is correct. -- To unsu

Re: in-place edit prefix?

2002-07-16 Thread Chas Owens
On Tue, 2002-07-16 at 08:25, David T-G wrote: > Hi, all -- > > I like being able to use -i to set an in-place edit suffix like .bak for > the original copy of my files. Since I use the old MIT/Athena delete(1) > program, though, I'd like even more to be able to define a *prefix* for > the origin

Re: Calculate with operators known at runtime (was: Scalar context problem I think)

2002-07-16 Thread Janek Schleicher
Harry Jackson wrote at Tue, 16 Jul 2002 16:22:52 +0200: > If I have the following variables splits are numbers and totals are operators how >can I have them > executed to get the value. > > $split[0] $total[0] $split[1] $total[1] $split[2] $total[2] $split[3] $total[3] >$split[4]; > 45

Re: how to split a perl program on multiple files?

2002-07-16 Thread drieux
On Tuesday, July 16, 2002, at 07:18 , Martin A. Hansen wrote: > for the sake of order and logic, i want to split my perl script into two > files. > > what is the smart way to do this? [..] you really should not put temptation in the way of some So i will try to avoid the 'down the middle'

RE: Scalar context problem I think

2002-07-16 Thread Nikola Janceski
Let's make this easier here's an example of what it should look like in the end: my @crap = qw(45 / 3 + 6 - 4 * 2); my $ans = eval( "@crap" ); print "$ans\n"; ## prints 13; > -Original Message- > From: Jackson, Harry [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 10:23 AM >

Scalar context problem I think

2002-07-16 Thread Jackson, Harry
Hi If I have the following variables splits are numbers and totals are operators how can I have them executed to get the value. $split[0] $total[0] $split[1] $total[1] $split[2] $total[2] $split[3] $total[3] $split[4]; 45 \ 3 + 6 - 4

Re: perl modules?

2002-07-16 Thread drieux
On Tuesday, July 16, 2002, at 01:13 , Paul Johnson wrote: I think one of my unresolved concerns about the modules/libraries we have seen this month is this idea of using them to cache 'variables' that people want to access directly, rather than say, using them to cache 'objects' my

how to split a perl program on multiple files?

2002-07-16 Thread Martin A. Hansen
for the sake of order and logic, i want to split my perl script into two files. what is the smart way to do this? i guess there is many ways this can be done, lemmy hear them all ! :o) martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Still Can't get perl to work on Win2K Pro PC

2002-07-16 Thread Anders Holm
Cory, of course you'd need to be in the directory where "example.pl" is located. :) If you're not then you'd get that message. Otherwise it looks like things are setup nicely on your system. Enjoy your future Perl Hacking! :) Best Regards Anders Holm Critical Path Technical Support Engineer --

Re: Still Can't get perl to work on Win2K Pro PC

2002-07-16 Thread Shawn
Hey Cory, Let go from the top... Perl is installed... Perl is in your PATH... Your script 'example.pl' is in the directory C:\>... You get the error 'No such file or directory' when you type C:\>perl example.pl Is this all correct? My initial guess would be that you are in a

RE: Retrieving Data from a Db using Perl

2002-07-16 Thread Rajaraman_Seetharaman
Hi Michael, Try the following code might be useful..in connecting to a database..and retrieving value... $dbh = DBI->connect("DBI:Oracle:$dbname", $user, $options, {AutoCommit=>0}) $statement = "Select * from emp" $sth = $dbh->prepare($statement) $sth = $dbh->prepare($statement, {

RE: Strange tie Problem

2002-07-16 Thread Nikola Janceski
The first element is a filehandle (or reference to one) and once the filehandle is closed the element is now uninitialized. I think the module didn't splice out that element. You have no value for that element from the data you are tying. What does $array[0] have? have you tried debuggin

Still Can't get perl to work on Win2K Pro PC

2002-07-16 Thread cory
when I type perl example.pl at the C:\>command prompt I get this message: cannot open perl script "example.pl": No such file or directory. When I go to the folder that example.pl is located and double click on it opens for about 1/4 of a second that automatically closes. when I type PATH at t

Strange tie Problem

2002-07-16 Thread atul
The following snippet is from "Advanced perl programming" by Sriram Srinivasan. A test program is also attached. If I print any other list element, it works fine but for the first element ( $array[1] ), it gives a warning. What's on?? Perl version is 5.6.0 on RH Linux 7. /home/atul/myperl> ./ts

  1   2   >