Re: formatting numbers

2002-04-29 Thread John W. Krahn
Pat wrote: > > I have been through man printf, info printf and perldoc -f print and still > can't find how to format numbers. > In the program below I would like to print the numbers as below: > 383.3as 383.30 $ perl -le'printf "%.2f\n", 383.3' 383.30 > 37492908 as 37 492 90

Re: Process Tree

2002-04-29 Thread sharan
Process is not created by fork, I am using, Proc::Background to create process, which uses, either, Win32::Process for windows, It is transparent to me, whether i run on linux or windows. The kind of application what we are developing needs both windows and linux support. Why I need to kill ex

RE:Regexp correction

2002-04-29 Thread Jorge Goncalvez
Hi, i have this code : opendir(DIR,"$_Globals{CDROM}:/DHS3MGR/$_Globals{TEL_VERSION}/DHS3Linux"); foreach (readdir(DIR)){ unless (/([Comm]+)/){ $box3->insert('end', $_); } } closedir(DIR); I wanted to have all that there is in DIR except the directory C

RE: Send email with attachment

2002-04-29 Thread Jackson, Harry
>-Original Message- >From: Ahmed Moustafa [mailto:[EMAIL PROTECTED]] > > >Hi All, > >Would you post an example of sending an email with attachment(s) using >Net::SMTP, please? > Send an example of one that you have tried to code, if you have one, and someone will probably try and help

RE:Regexp correction

2002-04-29 Thread Felix Geerinckx
on Mon, 29 Apr 2002 08:40:13 GMT, [EMAIL PROTECTED] (Jorge Goncalvez) wrote: > foreach (readdir(DIR)){ > unless (/([Comm]+)/){ > $box3->insert('end', $_); > } > } > closedir(DIR); The [] signal a character class in a regex, meaning 'match any of the charact

RE: #exec / perl ?

2002-04-29 Thread Anders Holm
Looks to me like your not allowed to execute cgi scripts in that directory. Have you checked your web servers configuration for this? Best Regards Anders Holm Critical Path Technical Support Engineer -- Tel USA/Canada: 1 800 353

Getting contens of file into a hash

2002-04-29 Thread Anders Holm
Hi folks! Could someone point me in the right direction on this one. I'm trying to input /proc/cpuinfo on a Linux box into a hash. This file contains information of the processors on the running machine, what type they are, number of cpu's etc. and I want to use this info later. Now the problem

Concatenation , the final time

2002-04-29 Thread james poni
>From: "james poni" <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Concatenating , the final time >Date: Mon, 29 Apr 2002 11:57:18 +1000 > > > >Hello again (final time) > >I also want to sort the (number time) field when we have the same day >eg: > >below: >ccc gamma sun 3:00 >aaa aplha

Re: Getting contens of file into a hash

2002-04-29 Thread Michael Lamertz
On Mon, Apr 29, 2002 at 11:59:42AM +0100, Anders Holm wrote: > Hi folks! > > Could someone point me in the right direction on this one. > > I'm trying to input /proc/cpuinfo > on a Linux box into a hash. This file > contains information of the processors on the running machine, what type > they

Quick question on Sorting

2002-04-29 Thread james poni
Hello again (final time) I also want to sort the (number time) field when we have the same day eg: below: ccc gamma sun 3:00 aaa aplha mon 1:00 <1,12:30=>2,13:00=>3,13:30=>4 ..) ? THIS THE PROGRAM $line1 = "aaa alpha\nbbb beta\nccc gamma\nddd delta\neee epsilon\nzzz zeta\n ita\n"

Re: Getting contens of file into a hash

2002-04-29 Thread Michael Lamertz
Whooops: On Mon, Apr 29, 2002 at 02:12:27PM +0200, I wrote: > On Mon, Apr 29, 2002 at 11:59:42AM +0100, Anders Holm wrote: > > Hi folks! > > > You're right on track (with some exceptions, but read about that further > down the page). > > my ($key, $value) = split /:/; make that 'split /\s*

Selftuition

2002-04-29 Thread Richard Adams
Hi, I've been teaching myself Perl and C in preparation for a new job. I've been using Wrox's "Beginning Perl" and the Camel book for Perl, and K&R and the Deitel&Deitel "How to program " for C. Does anyone know of a Perl instruction book/web resource that has plenty of exercises (with example ans

Sys::Syslog

2002-04-29 Thread Rus Foster
Hi all, I've wonder if you get help me with a problem I'm having. ATM I've managed to log to my local syslog using the following code #!/usr/sbin/perl use Sys::Syslog qw(); $user = $ENV{'USER'}; openlog($0,'','user'); syslog('info', "$user logged this comment"); closelog; What I would however

Re: Selftuition

2002-04-29 Thread Felix Geerinckx
on Mon, 29 Apr 2002 13:00:58 GMT, [EMAIL PROTECTED] (Richard Adams) wrote: > Does anyone know of a Perl instruction book/web resource that has > plenty of exercises (with example answers) like the Deitel book > for C? Have a look at the Perl Cookbook. You could try the problems yourself befor

RE: Getting contens of file into a hash

2002-04-29 Thread Anders Holm
Thank you Micheal!! Having loads of fun with this at the moment!! ;) There seems to be another caveat as well, SMP systems. ;) Fortunate enough to be able to test it on such a box at work. So, input would be something of the following: [anders@redhat anders]$ cat /proc/cpuinfo processor

accessing -lable value in cascade widget

2002-04-29 Thread richard noel fell
Below is some sample code which I hope will illustrate the problem I am facing. #!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w use Tk; use Tk::Dialog; use strict; ## my $mw = MainWindow->new; use subs qw/file_menuitem/; $mw->configure(-menu=>my $menu

RE: Selftuition

2002-04-29 Thread Jackson, Harry
>-Original Message- >From: Richard Adams [mailto:[EMAIL PROTECTED]] >Sent: 29 April 2002 14:01 >To: [EMAIL PROTECTED] >Subject: Selftuition > > >Hi, >I've been teaching myself Perl and C in preparation for a new >job. I've been >using Wrox's "Beginning Perl" and the Camel book for Perl,

Re: Selftuition

2002-04-29 Thread Jonathan E. Paton
> I've been teaching myself Perl and C in preparation for a new job. I've been > using Wrox's "Beginning Perl" and the Camel book for Perl, and K&R and the > Deitel&Deitel "How to program " for C. Does anyone know of a Perl > instruction book/web resource that has plenty of exercises (with example

Re: Getting contens of file into a hash

2002-04-29 Thread Michael Lamertz
On Mon, Apr 29, 2002 at 02:16:13PM +0100, Anders Holm wrote: > Thank you Micheal!! > > Having loads of fun with this at the moment!! ;) > > There seems to be another caveat as well, SMP systems. ;) Fortunate enough > to be able to test it on such a box at work. > > So, input would be something

Re: Getting contens of file into a hash

2002-04-29 Thread Dennis G. Wicks
Greetings; Thanks for all that tuteledge. Now if you could expand it to handle # processors: 3 col 1...5...105...20 that would be great! Apparently on my ver of linux something is supposed to see this as a comment and ignore it. TIA, Dennis >}On Apr 29, 14:12, Michael Lamert

RE: Getting contens of file into a hash

2002-04-29 Thread Ron Powell
Here's the code I came up with for testing whether the line read contains a : (and thus makes it eligible for SPLITting). #!/usr/bin/perl -w $filename = "/home/ron/perl/cpu.txt"; $output = system("cat /proc/cpuinfo>$filename"); open(INFILE,"< $filename"); while () { $linetest =$_;

GUI interfaces

2002-04-29 Thread Ron Woodall
Hi All: I require your assistance in finding a GUI interface for Perl. I've tried downloading Prima 1.05 but I can't get it installed. Similar problems with GUILoft. The problem seems to stem from my using IndigoPerl as opposed to ActivePerl. I can't get ActivePerl installed either but

RE: regex

2002-04-29 Thread Bob Showalter
> -Original Message- > From: drieux [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 28, 2002 11:16 AM > To: [EMAIL PROTECTED] > Subject: Re: regex > > > > On Sunday, April 28, 2002, at 07:13 , Mat Harrison wrote: > > > what sort of regex's should i be looking at to validate a > usern

RE: Send email with attachment

2002-04-29 Thread Bob Showalter
> -Original Message- > From: Ahmed Moustafa [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 28, 2002 2:47 PM > To: [EMAIL PROTECTED] > Subject: Send email with attachment > > > Hi All, > > Would you post an example of sending an email with > attachment(s) using > Net::SMTP, please?

RE: GUI interfaces

2002-04-29 Thread Timothy Johnson
You should check out Tk. I've just started using it, but it works very well. I would definitely recommend that you try to get ActivePerl running again, too. It really is the de facto standard for Win32 Perl, and most people will assume that you have it. -Original Message- From: Ron W

Re: Selftuition

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 06:00 , Richard Adams wrote: [..] > The main problem I've had learning Perl is trying to separate out the > "need > -to -know" stuff from the "very clever but you can get by without it" > info, > esp in the manpages and the Camel book. Also I find the exercises in

Re: assigning array to hash

2002-04-29 Thread Chas Owens
On Sat, 2002-04-27 at 12:14, drieux wrote: > > On Friday, April 26, 2002, at 03:49 , Shaun Fryer wrote: > [..] > > > > foreach $value (@array) { > > $scalar_array .= "$value|"; > > } > > chop($scalar_array); > > my %hash; > > $hash{some_key} = $scalar_array; > > > > Then if you want to get

Re: Sys::Syslog

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 06:06 , Rus Foster wrote: [..] > What I would however like to do is log to a remote machine without having > to put something like > > *.info@loghost > > in my /etc/syslogd.conf > > Is this possible? Looking over the man page it doesn't seem so but I might >

Re: regex

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 07:10 , Bob Showalter wrote: [..] >> my $MAXWORD = 15; >> my $pattern = qr/^\w{1,$MAXWORD}$/; > > That matches both "foobar\n" and "foo_bar", which would > seem to be "illegal" values. good catch I clearly misread what the "\w" would limit on... > Perhaps the

fun with sheBang was Re: I can't get this to run!

2002-04-29 Thread drieux
On Sunday, April 28, 2002, at 05:57 , Peter Scott wrote: > At 05:20 PM 4/27/2002 -0700, drieux wrote: >>> That's because the shebang line is ignored when you prefix the script >>> with >>> the perl command. >> >> you are correct - but I prefer to assert it the other way around, >> >> when the p

RE: simple problem

2002-04-29 Thread Hanson, Robert
> if ( $tablename > 1){ Why would $tablename be a number? Is this really what you want? Maybe you really wanted to check the length? if ( length($tablename) > 1 ) Or a little better if ( length($tablename) ) Or better yet if ( $tablename ) Rob -Original Message- From: Sun

RE: simple problem

2002-04-29 Thread Jackson, Harry
>-Original Message- >From: Sun-hee Kim [mailto:[EMAIL PROTECTED]] > >if ( $tablename > 1){ > >$sth = $dbh->prepare("SELECT * from $tablename") || die "3: " >. $dbh->errstr; Not sure if you have to or not but don't you need $sth->prepare(); before execution or is that only Oracle

Re: Concatenating , the final time

2002-04-29 Thread drieux
On Sunday, April 28, 2002, at 06:57 , james poni wrote: > How would i modify this program in order to do so ? Do i need a time hash > eg time = (12:00 =>1,12:30=>2,13:00=>3,13:30=>4 ..) ? why not a simple two stage sort routine? having solved for the day value split the 'time' field into

RE: simple problem

2002-04-29 Thread Jackson, Harry
Is it standard practice to cross post between mailing lists here or unacceptable. Harry * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London

Learning to Code (was RE: Selftuition)

2002-04-29 Thread Anthony Beaman
I posted a similar question recently and got great answers! My problem with coding is that the learning process seems mysterious at times. I guess I'm used to a cut and dried approach to things and learning to code isn't, or am I wrong? For example, sometimes I'm not sure which books to read or

RE: simple problem

2002-04-29 Thread Nikola Janceski
General Rule of Thumb: Don't cross post. If you must. Post once on one list. Wait for responses. If you don't get the answer you are looking for. Post once on your other list. Repeat as necessary. There are many of us who are subscribed to several lists and don't like the crosspos

Re: authentication and user management

2002-04-29 Thread bob ackerman
On Monday, April 29, 2002, at 08:28 AM, Mat Harrison wrote: > that looks like the sort of thing, but i don't want the script to die if > the > cookie doesn't exist and i'm sorry, but I don't really understand the > second > snippet the first snippet showed you my current code. you don't have

Re: Selftuition

2002-04-29 Thread Peter Scott
At 02:00 PM 4/29/02 +0100, Richard Adams wrote: >Does anyone know of a Perl >instruction book/web resource that has plenty of exercises (with example >answers) like the Deitel book for C? Yes. Although neither book has answers IIRC, "Elements of Programming with Perl" by Andrew Johnson has some

Re: Serious problem with perl -pi -e

2002-04-29 Thread Peter Scott
At 12:35 PM 4/27/02 +0530, sharan wrote: >Hello, > >I lost my files, while using perl -pi -e. >I wanted to replace a world in a set of files, "perl -pi -e >'s/somestring/somethingelse/g' *.pl" >but, it gave error saying permission denied and all the files got deleted. > >If it cant rewrite the fil

RE: Fixing the Quality of our OldBies was Re: GoryDetails on: error log message

2002-04-29 Thread Timothy Johnson
I'd definitely have to agree with you on that one. As much as it may seem so when under the influence, none of us are can put out good code without thinking about it, and alcohol is definitely not conducive to lucid thought. This also applies to uppers, downers, crack, smack, and beanie babies.

Re: Learning to Code (was RE: Selftuition)

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 09:05 , Anthony Beaman wrote: > I posted a similar question recently and got great answers! My problem > with coding is that the learning process seems mysterious at times. I > guess I'm used to a cut and dried approach to things and learning to code > isn't, or

RE: Quick question on Sorting

2002-04-29 Thread Wagner-David
I modified your sort to be like: @info = sort { $days{$a->[1]} <=> $days{$b->[1]} || $a->[2] =~ /^\d+/ <=> $b->[2] =~ /^\d+/ || $a->[2] =~ /:\d+/ <=> $b->[2] =~ /:\d+/ } @info; I then reversed all your data within the simple script and this is the output: ccc gamma sun 3:00 aaa alpha

Re: Fixing the Quality of our OldBies was Re: GoryDetails on: err or log message

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 09:53 , Timothy Johnson wrote: > I'd definitely have to agree with you on that one. As much as it may seem > so when under the influence, none of us are can put out good code without > thinking about it, and alcohol is definitely not conducive to lucid > thought.

[OT] Regional bragging was RE: Fixing the Quality of our OldBies was Re: GoryDetails on: err or log message

2002-04-29 Thread Stout, Joel R
Easy for you to say...you don't live in Portland where we have the finest beer in the world. :) J -Original Message- From: Timothy Johnson [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 9:53 AM To: '[EMAIL PROTECTED]' Subject: RE: Fixing the Quality of our OldBies was Re: GoryD

Calculating Last Login on Unix

2002-04-29 Thread gkhgkh
Is there a module or a method using perl to calculate the last login date for a user. I know I can do this by installing accounting, however I prefer not to do to other issues. Any thoughts/help is appreciated. Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-

RE: [OT] Regional bragging was RE: Fixing the Quality of our OldBies was Re: GoryDetails on: err or log message

2002-04-29 Thread Timothy Johnson
Hey, don't get me wrong, I enjoy a good beer, I've been on a Gordon Biersch kick for a while now, just not when I'm coding or doing anything else that requires cohesive thought. -Original Message- From: Stout, Joel R [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 10:28 AM To: 'T

Re: Calculating Last Login on Unix

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 10:27 , [EMAIL PROTECTED] wrote: > Is there a module or a method using perl to calculate > the last login date for a user. I know I can do this by > installing accounting, however I prefer not to do to > other issues. well there is the 'last' command that is reaso

Re: Calculating Last Login on Unix

2002-04-29 Thread gkhgkh
That gives me the information I want, the problem is it relies on wtmp. I believe wtmp gets nulled out on an ipl of the server and therefore nulls wtmp. Therefore I lose my history. What I am trying to do is identify user IDs that have not been used for say 60 days and get rid of them. Th

RE: Calculating Last Login on Unix

2002-04-29 Thread Wagner-David
Maintain your own little db using the info from wtmp and then you are not relying upon wtmp but only to get the info and keep in your own db. Wags ;) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 10:59 To: [EMAIL PROTECTED]; Pe

Re: Calculating Last Login on Unix

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 10:58 , [EMAIL PROTECTED] wrote: [..] > ipl of the server and therefore nulls wtmp [..] good God Man! no one uses 'ipl' - it will scare the kiddies Wags is correct that what you want to do is build a db solution, most likely something with the tie since wh

Re: Calculating Last Login on Unix

2002-04-29 Thread Adam Morton
> On Monday, April 29, 2002, at 10:58 , [EMAIL PROTECTED] wrote: > [..] > > ipl of the server and therefore nulls wtmp > [..] > > good God Man! no one uses 'ipl' - it will scare the kiddies Is this, like, ancient IBM speak for "reboot"? IPL = "initial program load"? > That gives me the info

Re: Selftuition

2002-04-29 Thread Beau
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 OK, drieux, you've got me convinced; it's all about perldoc. Your delicious semi-psychotic ramblings are just the aspect of the perl community that makes me cringe at the thought of going back to a M$ shop. But here's the problem with self-tuitio

Re: Quick question on Sorting

2002-04-29 Thread John W. Krahn
James Poni wrote: > > Hello again (final time) > > I also want to sort the (number time) field when we have the same day > eg: > > below: > ccc gamma sun 3:00 > aaa aplha mon 1:00 < eee epsilon mon 3:00 < zzz zeta mon 4:00 << is sorted if the same day > ddd delta tue 1:00 << > iii ita

RE: Calculating Last Login on Unix

2002-04-29 Thread CATHY GEAR (TRUST HQ)
Probably not what you may want, but we have a simple bit added to a user's ..profile file: As the user logs in, their previous date and time are stated; then the file is overwritten with the new date and time: echo "The $(whoami) account was last activated on:" echo $(cat ~/date.txt) date > ~/d

Re: Selftuition

2002-04-29 Thread Chas Owens
On Mon, 2002-04-29 at 14:46, Robert Beau Link wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > OK, drieux, you've got me convinced; it's all about perldoc. Your > delicious semi-psychotic ramblings are just the aspect of the perl > community that makes me cringe at the thought of g

Scripts picks random elements from array , but it repeats sometimes

2002-04-29 Thread FLAHERTY, JIM-CONT
Hello , My script picks out random elements from an array , but it sometimes repeats ( which is no good) .. I want to prevent this , Do I delete the element from the array or is there a better way ? And how do I do either ? Thanks Jim

FW: Scripts picks random elements from array , but it repeats sometimes

2002-04-29 Thread FLAHERTY, JIM-CONT
Hello , My script picks out random elements from an array , but it sometimes repeats ( which is no good) .. I want to prevent this , Do I delete the element from the array or is there a better way ? And how do I do either ? my mistake here is the code while($numofques > 0)

Re: Selftuition

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 11:46 , Robert Beau Link wrote: [..] > OK, drieux, you've got me convinced; it's all about perldoc. Your > delicious semi-psychotic ramblings Semi? Only Semi God god, get me the walker, the dribble cup, and the CostCo Warehouse family size bottle of Geratol it'

RE: Scripts picks random elements from array , but it repeats som etimes

2002-04-29 Thread Bob Showalter
> -Original Message- > From: FLAHERTY, JIM-CONT [mailto:[EMAIL PROTECTED]] > Sent: Monday, April 29, 2002 2:58 PM > To: Beginners (E-mail) > Subject: FW: Scripts picks random elements from array , but it repeats > som etimes > > > > Hello , My script picks out random elements from an a

RE: Scripts picks random elements from array , but it repeats som etimes

2002-04-29 Thread Wagner-David
Here is one option: #!perl -w my @numbers = qw( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ); my $numofques = scalar(@numbers); my @MySeen = (); while($numofques > 0) { $index = rand @numbers; next if ( defined$MySeen[$index] ); $element = $numbers[$index]; printf "

SNMP help

2002-04-29 Thread Kessler, Ben
Hi all, I've installed the ucd-snmp tools (ver. 4.2.4) on my RH7.0 box and am having problems getting the Perl SNMP module installed. I've tried the one included with the ucd-snmp distribution as well as downloading directly from CPAN and no joy. I've tried the RTFM route but the install dire

B/C - Re: Selftuition

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 11:47 , Chas Owens wrote: [..] >> I hear "Learning Perl" is the best bet for a structured set of >> exercises building in a graduated manner from simple to difficult. >> - -- >> beau [..] > The best advice I can give is read the 3rd Llama (Learning Perl 3rd > edition

RE: B/C - Re: Selftuition

2002-04-29 Thread Anthony Beaman
Bingo! I agree and I think that's my problem with all of this. I think that the documentation pages can be over a newbie's (myself) head. For example, the Win32 extensions are great and I'm really getting into them but I have problems sometimes getting them to run in my codes. Good advice, also

RE: Scripts picks random elements from array , but it repeats som etimes

2002-04-29 Thread Bob Showalter
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] > Sent: Monday, April 29, 2002 3:18 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: RE: Scripts picks random elements from array , but it repeats > som etimes > > > Here is one option: > #!perl -w

The book Learning Problem

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 12:45 , Anthony Beaman wrote: > Bingo! I agree and I think that's my problem with all of this. I think > that the documentation pages can be over a newbie's (myself) head. Part of that is understanding what the 'gliphs' are - if you have no idea what a scalar or a

Re: The book Learning Problem

2002-04-29 Thread Brent Michalski
Not to plug my own book, but have you taken a look at "Writing CGI Applications with Perl"? (ok, I plugged my own book, sue me ;o) ) Myself and Kevin Meltzer took a different approach to how this book is laid out. It is not a bunch of theory and extra reading. Instead, we list real-world ex

Re: Scripts picks random elements from array , but it repeats sometim es

2002-04-29 Thread Felix Geerinckx
on Mon, 29 Apr 2002 18:55:41 GMT, Jim-Cont Flaherty wrote: > Hello , My script picks out random elements from an array , but it > sometimes repeats ( which is no good) .. I want to prevent this , Do > I delete the element from the array or is there a better way ? Lookup the 'fisher_yates_sh

Re: FW: Scripts picks random elements from array , but it repeats sometimes

2002-04-29 Thread John W. Krahn
Jim-Cont Flaherty wrote: > > Hello , My script picks out random elements from an array , but it sometimes > repeats ( which is no good) .. I want to prevent this , Do I delete the > element from the array or is there a better way ? And how do I do > either ? > > my mistake here is the code

RE: B/C - Re: Selftuition

2002-04-29 Thread Chas Owens
On Mon, 2002-04-29 at 15:45, Anthony Beaman wrote: > Bingo! I agree and I think that's my problem with all > of this. I think that the documentation pages can be over > a newbie's (myself) head. For example, the Win32 extensions > are great and I'm really getting into them but I have > problems s

Re: Scripts picks random elements from array , but it repeats som etimes

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 01:03 , Bob Showalter wrote: > May I suggest a modification of the algorithm that avoids this > problem: > >1. generate a random index from 1 to (number of remaining elements) >2. use the element at that index >3. move the last element into the index gen

RE: Scripts picks random elements from array , but it repeats som etimes

2002-04-29 Thread Bob Showalter
> -Original Message- > From: drieux [mailto:[EMAIL PROTECTED]] > Sent: Monday, April 29, 2002 4:51 PM > To: [EMAIL PROTECTED] > Subject: Re: Scripts picks random elements from array , but it repeats > som etimes > > > > On Monday, April 29, 2002, at 01:03 , Bob Showalter wrote: > > > M

Re: wipe out elements in an array

2002-04-29 Thread Bryan R Harris
Thanks to all for the tips, and for introducing me to the grep and splice functions. As a sidenote, I mucked around and discovered that for my purposes, just assigning that element to "" works fine, since I'm just printing the results back out to a file and the individual elements have their new

array numerical name...

2002-04-29 Thread Steven_Massey
Hi all - should be simple - but I cannot figure it out basically i want to name an array with a subscript ie world0[0] and world1[0] the 0/1 being a variable, i have tried to produce a simple example For any help - thanks.. -- @fre

RE: array numerical name...

2002-04-29 Thread Timothy Johnson
I think you may be barking up a branch of the right tree... It looks like what you REALLY want is an array of arrays. Check out 'perldoc perllol' and/or look up perl array of arrays in your favorite search engine, and that should get you started. -Original Message- From: [EMAIL PROTECT

Re: Scripts picks random elements from array , but it repeats som etimes

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 02:03 , Bob Showalter wrote: > splice() will be slower as the size of the array grows. If I take > your benchmark and change to array from 1..100 to 1..1, I get > the following results for 100 iterations (on an old Pentium 266): > > Benchmark: timing 100 iterati

RE: Scripts picks random elements from array , but it repeats som etimes

2002-04-29 Thread Nikola Janceski
what about? my @numbers = 1..100; while($#numbers >= 0) { my $index = rand $numofques; my $element = $numbers[$index]; $numbers[$index] = pop @numbers; # replace the number we used with the last element and shrink array printf "%-3d ", $element; } printf "\n" Wouldn

Re: array numerical name...

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 02:19 , [EMAIL PROTECTED] wrote: > Hi all - should be simple - but I cannot figure it out > > basically i want to name an array with a subscript ie world0[0] and > world1[0] the 0/1 being a variable, i have tried to > produce a simple example do I feel you

Re: array numerical name...

2002-04-29 Thread Chas Owens
On Mon, 2002-04-29 at 17:19, [EMAIL PROTECTED] wrote: > Hi all - should be simple - but I cannot figure it out > > basically i want to name an array with a subscript ie world0[0] and world1[0] the >0/1 being a variable, i have tried to > produce a simple example > > For any help - thank

Re: assigning array to hash

2002-04-29 Thread Shaun Fryer
> http://www.wetware.com/drieux/CS/lang/Perl/Beginners/BenchMarks/loopVjoin.txt > drieux Thanks Drieux, I had no idea this could even be done. --- $hash{$jref_key} = \@array; my @new_array = @{$hash{$jref_key}}; --- Guess why I'm on this list? ;) I have one tiny question tho

Hidden fields and Perl

2002-04-29 Thread ray
What I am trying to do is develop a manager for albums and songlist. I have gotten most of it done. However, here I am having problems with Perl keeping the values set via a form hidden field. -- this is how the link looks when the script is called.. song_admin.cgi?name=Test&file=Test.txt&artis

Sorting

2002-04-29 Thread Imtiaz ahmad
Hi- Lets say if we have an ARRAY @array_1 with following values: 31472 468X60 1.49 31473 468X60 2.18 31488 180X60 1.39 31476 468X60 1.58 33472 120X60 2.49 32473 468X60 4.38 for($i=0;$i<$#sql_results1;$i++)

Re: The book Learning Problem

2002-04-29 Thread Peter Scott
At 01:14 PM 4/29/02 -0700, drieux wrote: >On Monday, April 29, 2002, at 12:45 , Anthony Beaman wrote: > >>Bingo! I agree and I think that's my problem with all of this. I think >>that the documentation pages can be over a newbie's (myself) head. > >Part of that is understanding what the 'gliphs'

Re: assigning array to hash

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 02:50 , Shaun Fryer wrote: > >> http://www.wetware.com/drieux/CS/lang/Perl/Beginners/BenchMarks/loopVjoin. >> txt >> drieux > > Thanks Drieux, > I had no idea this could even be done. [..] thanks for the catch on that !!! I had been off working on the new va

simple problem

2002-04-29 Thread Sun-hee Kim
Hi, I 'm trying to pull information from a form using mysql and perl. The form has radio buttons and when i try to get the information that is selected for some reason its not getting it. I was trying to say for example if i select this option then grab all the information from that table

Re: simple problem

2002-04-29 Thread Sun-hee Kim
Here's the code: if ( $tablename > 1){ $sth = $dbh->prepare("SELECT * from $tablename") || die "3: " . $dbh->errstr; $sth->execute(); while (my @data = $sth->fetchrow_array){ ... .. Sorry about that On Monday 29 April 2002 08:50 am, Jones Robert Contr TTMS

Re: simple problem

2002-04-29 Thread Jeffrey . Seger
if ( $tablename > 1) is going to evaluate to false since the numeric value of any string is 1. Try: if ($tablename) or: if (defined($tablename)) *** Jeff Seger Data Warehouse Engineer Fairchild Semiconductor [EMAIL PROTECTED] ***

RE: simple problem

2002-04-29 Thread Jones Robert Contr TTMS Keesler
No code, No help -Original Message- From: Sun-hee Kim [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 10:51 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: simple problem Hi, I 'm trying to pull information from a form using mysql and perl. The form has radio butto

RE: simple problem

2002-04-29 Thread Jones Robert Contr TTMS Keesler
That part looks fine. Shouldn't there be more code than this? Where's the code that pulls the form values? Are the values already put into the database and you're trying to retreive them from there? Do you see the values in the database to ensure they are getting there correctly? Is this t

Re: The book Learning Problem

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 03:55 , Peter Scott wrote: > At 01:14 PM 4/29/02 -0700, drieux wrote: >> On Monday, April 29, 2002, at 12:45 , Anthony Beaman wrote: >> >>> Bingo! I agree and I think that's my problem with all of this. I think >>> that the documentation pages can be over a newbie'

Re: Scripts picks random elements from array , but it repeats som etimes

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 02:03 , Bob Showalter wrote: [..] http://www.wetware.com/drieux/CS/lang/Perl/Beginners/BenchMarks/randTest.txt has been updated to take in more data... > > splice() will be slower as the size of the array grows. If I take > your benchmark and change to array from 1

Re: Sorting

2002-04-29 Thread John W. Krahn
Imtiaz Ahmad wrote: > > Hi- Hello, > Lets say if we have an ARRAY @array_1 with following values: > > 31472 468X60 1.49 > 31473 468X60 2.18 > 31488 180X60 1.39 > 31476 468X60 1.58 > 33472 120X60 2.49 > 32473 468X60 4.38 > > #

Re: Hidden fields and Perl

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 12:46 , ray wrote: [..] > here are the hidden fields that get their values once the &parseform sub > is > done.. > > print ""; > print ""; > print ""; > > > print ""; > print " name=\"delLink\">\n"; wouldn't you rather have this as a POST [..] hence not trying to

Re: Hidden fields and Perl

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 12:46 , ray wrote: Sorry about the original response - typed at what I thought was an idea - should have read your code in more depth... > print " name=\"delLink\">\n"; I assume that song_admin.cgi is suppose to catch them > print ""; > print ""; > > > print

need help

2002-04-29 Thread Luinrandir Hernsen
This line is from a script if ($Config{'print_blank_fields'} || $Form{$field} ne '0') I need to change the last part (in bold) to read for both 0 and the empty set '' so the logic should read if ($Config{'print_blank_fields'} || $Form{$field} ne '0' or '' ) Or to say it another way I need the

Re: need help

2002-04-29 Thread Todd Wade
"Luinrandir Hernsen" <[EMAIL PROTECTED]> wrote in message 00f901c1efe0$0b20db60$[EMAIL PROTECTED]">news:00f901c1efe0$0b20db60$[EMAIL PROTECTED]... This line is from a script > Or to say it another way I need the following two lines to be one. > if ($Config{'print_blank_fields'} || $Form{$field}

Re: Scripts picks random elements from array , but it repeats som etimes

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 02:34 , Nikola Janceski wrote: > what about? > > my @numbers = 1..100; > while($#numbers >= 0) { > my $index = rand $numofques; > my $element = $numbers[$index]; > $numbers[$index] = pop @numbers; # replace the number we used with > the > last e

Re: Send email with attachment

2002-04-29 Thread Ahmed Moustafa
Bob Showalter wrote: >>-Original Message- >>From: Ahmed Moustafa >>Sent: Sunday, April 28, 2002 2:47 PM >>To: [EMAIL PROTECTED] >>Subject: Send email with attachment >> >> >>Hi All, >> >>Would you post an example of sending an email with >>attachment(s) using >>Net::SMTP, please? >> > >

Re: assigning array to hash

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 08:29 , Chas Owens wrote: > > TMTOWTDI: > > my @array = qw(first second last); > my %hash; > #the $" var controls what characters separate elements of > #an interpolated array > { local $" = '|'; $hash{somekey} = "@array"; } can You get Your Brilliant Flashes in Ge

Re: array numerical name...

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 02:42 , Chas Owens wrote: [..] > > EVAL METHOD > #!/usr/bin/perl -w > use strict; > > my @fred = "one,two,three,four"; > > for my $a (0..3) { > eval "my \@array$a=split(/,/, \@fred)"; > } > > for my $b (0..3) { > eval qq(print \@array$a[\$b], "\\n"); > }

Re: wipe out elements in an array

2002-04-29 Thread drieux
On Monday, April 29, 2002, at 01:52 , Bryan R Harris wrote: > Out of curiosity, do the $, $/ $\ variables maintain their values between > runs? Or are they reset before running a new script? the short answer is that 'All Perl Special Variables are set to the default upon invocation' - hence if

  1   2   >