RE: sorting multi dimensional array

2004-03-17 Thread Ed Christian
N, Guruguhan (GEAE, Foreign National, EACOE) wrote: > Hi All, >I have a multi dimensional array build like this " > $array[$i][$j]". This array has some 50 values and I would like to > sort this in ascending order. Can somebody tell me how to do this? > Quick and easy (but certainly

RE: [The Subroutine...revisited] What is "Use of uninitialized JOIN" error?

2004-07-13 Thread Ed Christian
jason corbett wrote: > Here is what I am doing. I shortend the sub, using local variables, > and simplifying the whole thing to just print to screen. I use your > loop once I collect the records into the @record variable and join > them with ","... > > Still to no avail, that menacing warning s

RE: Still getting warning for "Use of uninitialized value in join or string " (Please Help)..

2004-07-15 Thread Ed Christian
jason corbett wrote: > I would like to know why this warning is coming back: > > Use of uninitialized value in join or string at line 65. [snip] > while( @record= $sth->fetchrow_array( )) > > { > > my $recordlist = ' '; > $recordlist=join(",",@record); #This statement is causing th

RE: Efficient Formatting

2004-07-21 Thread Ed Christian
Kent, Mr. John (Contractor) wrote: > Greetings, > > Want to print out a formattted line of numbers > > Is there a way to avoid having to: > >> printf "%8d %8d %8d . ten times",$num1,$num2,$num3, ... , >> $num10; ? > > Something like > printf "%8d" * 10, @numray; > How 'bout: printf "%8d

Questions regarding use: "optional" modules, and "refreshing" modules

2004-08-31 Thread Ed Christian
Folks, I've run into a couple of issues with use and was hoping someone could help me come up with a solution. First, I use a specific module in a work environment to set some global variables. I want to re-use my code in another environment which doesn't have the specific configuration module. I

RE: Questions regarding use: "optional" modules, and "refreshing" modules

2004-08-31 Thread Ed Christian
Wiggins d Anconia wrote: >> Folks, >> >> I've run into a couple of issues with use and was hoping someone >> could help me come up with a solution. >> >> First, I use a specific module in a work environment to set some >> global variables. I want to re-use my code in another environment >> which

RE: SIGZERO

2004-09-24 Thread Ed Christian
Errin Larsen wrote: > Hi Perlers, > > > if( kill 0 => $pid ) { > Forgive me if I presume too much, but shouldn't the above be: if( kill 0, $pid ) { perldoc -f kill -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: SIGZERO

2004-09-24 Thread Ed Christian
Errin Larsen wrote: > On Fri, 24 Sep 2004 10:31:36 -0400, Ed Christian <[EMAIL PROTECTED]> > wrote: >> Errin Larsen wrote: >>> Hi Perlers, >>> >> >> >> >>> >>> if( kill 0 => $pid ) { >>> >> >&g

RE: array of references

2004-10-25 Thread Ed Christian
Scott Pham wrote: > I've been thinking about this and not sure how to approach this > problem. Say I want to create an array of 4 array references, thats > easy since I know that there will be 4 array references, how would I > do this dynamically? Say if one I only needed 2 references and > another

RE: Printing to a file

2004-10-26 Thread Ed Christian
> #!/usr/bin/perl > > + > use warnings; > use strict; > use File::Find; > > find sub { > return unless -f; > return unless $_ =~ /.\d+$/; > print "$_\n"; > #print "$File::Find::name\n"; > > + > open(SD, "$_") or die "can't open $_ $!\n"; > #my $fh = IO::File->new(

RE: Printing to a file

2004-10-26 Thread Ed Christian
Ed Christian wrote: >> #!/usr/bin/perl >> >> + >> use warnings; >> use strict; >> use File::Find; >> >> find sub { >> return unless -f; >> return unless $_ =~ /.\d+$/; >> print "$_\n"; >> #print &q

RE: Change ctime of a file ?

2004-12-03 Thread Ed Christian
Jeff Westman wrote: > Is it possible to change the 'create timestamp' (ctime) of a file, > and if so, how? This would be the perl equivalent of Unix' "touch" > command. If you're looking for a close replacement for "touch", try: perldoc -f utime "Changes the access and modification times on e

RE: Help optimizing script

2004-12-07 Thread Ed Christian
JR wrote: > Greetings everyone, > > I'm very new to perl, so please don't laugh at my script ;-) > I wrote this script to login to my work box from home and change a > hosts > file to reflect my home ip address. I know there is a way to do this a > lot quicker and prettier. This is really just a

RE: RE : Regular expressions

2003-12-17 Thread Ed Christian
Hemond, Steve wrote: > Okay, here`s the real problem, > > # ps -efA |grep dispatch > cspenard 33958 45716 0 09:08:05 pts/8 0:00 > /prog/gena/8.1.1/bin/dispatch genie -u /prog/gena/impress/gui/im > msirois 37212 9842 0 08:41:17 pts/1 0:04 > /prog/gena/8.1.1/bin/dispatch genie -u /prog/gena

RE: Problems with Inheritance in GD::Graph

2003-12-17 Thread Ed Christian
Dan Anderson wrote: > I am trying out GD::Graph, which is a CPAN module that creates a > method new, and then for each graph type inherits that new method (I > think -- I had to open the code). > > So I tried calling: > > my $graph = GD::Graph::bars->new(400, 600); > > And I get the error: >

RE: Looping through file for regex

2004-01-02 Thread Ed Christian
James Edward Gray II wrote: > On Jan 2, 2004, at 10:10 AM, Paul Kraus wrote: > >>> Don't do that. The foreach reads the whole file into memory and >>> then walks it line by line. If we just want one at a time, let's >>> fetch them that way >> >> I don't agree with this. > > And I don't underst

Floating point errors in Perl

2002-12-03 Thread Ed Christian
Question for the masses: I have a script which iterates through percentiles, ostensibly starting at the 0th percentile and working up to the 100th percentile. I'd like the script to basically go as follows: my $increment = 0.01; my $percentile = 0.01; while ($percentile < 1.00) { print "$perce

RE: if structure voiding string when condition not met?

2002-12-19 Thread Ed Christian
Correct me if I'm wrong group (I'm still a Perl novice myself), but whenever one passes an argument to a subroutine, shouldn't one always set local variables to $_[x]? Or at the very least add my @params = @_? Paul: My suggestion is to add "my $param = $_[0];" as the first line of sub buildexcel,

RE: Where do die messages go?

2003-01-14 Thread Ed Christian
Why not: (!(-e $file)) ? die "File doesn't exist: $@\n" : open (...$file...) or die "File exists but still can't open: $@\n"; > I'm not 100% confident that'll work as written. I *think* > that if the > open is successful then the die will never execute and that 'if' will > never get checked.

RE: Random Number Generation

2003-01-15 Thread Ed Christian
> -Original Message- > From: Maurice O'Prey [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 15, 2003 9:28 AM > Hi All > > How do I extract a whole number from the rand function. > > I am using rand 25000; which generates a random number with > many decimal > places, e.g. 16235.258

RE: Trouble with hash lookup

2003-01-28 Thread Ed Christian
Try replacing "==" with "eq" print "$lookup{$key}\n" if $key eq $user; > -Original Message- > From: Kipp, James [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 28, 2003 3:12 PM > To: [EMAIL PROTECTED] > Subject: Trouble with hash lookup > > > Should be a simple question. I am tryin

RE: sorting thoughts

2003-01-29 Thread Ed Christian
Undoubtedly not the best way of doing this, but here's one stab at it. This assumes you have your data stored in an array as a single string, rather than having an array of array pointers. my @array = ('fred:lucy:24', 'john:jane:10', 'frank:mary:5'); @array = sort { my @a_vals = split (':', $a);

[OT] RE: Looking for elegance ...

2003-07-10 Thread Ed Christian
http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=persnickety http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=pernickety Though "pernickety" seems to have evolved 100 years before "persnickety", "persnickety" seems to be the preferred spelling... (taken from Merriam-Webster's Onli

Is $1 ever undefined or set to null?

2003-07-21 Thread Ed Christian
I assumed that, $1 would be reset (either undefined or set to null) once I exited the scope of the while loop my regexp was called in. Sadly, I was mistaken. :) Below is a test example of code I wrote, with $1 values differing from those I expected. Do I need to explicitly set $1..$n to an empty st

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

RE: Read dir / sort

2003-08-22 Thread Ed Christian
Paul Kraus wrote: > Ok tested that theory and it is exactly what it is doing. That is not > a good thing. How can I force it to read the directory based on file > date instead of the way windows last sorted it. That does not seem > right to me that it would function like this. > > foreach ( readdi

RE: initialising a list of variables

2003-10-03 Thread Ed Christian
> my $fred=$ginger=''; Should be: my $fred = my $ginger = ''; > my ($fred,$ginger)=''; Should be: my ($fred,$ginger) = ('',''); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]