Re: using printf on specified fields of record

2004-11-17 Thread Joseph Paish
On Wednesday 17 November 2004 09:52, Bob Showalter wrote: > Joseph Paish wrote: > > following is a sample of a record generated by a perl script i have > > written ( i have put each field on a separate line in this email to > > prevent word-wrapping) : > > > >

using printf on specified fields of record

2004-11-17 Thread Joseph Paish
following is a sample of a record generated by a perl script i have written ( i have put each field on a separate line in this email to prevent word-wrapping) : 12/05/2003 sold 8000 widget1 0.055 29.95 30500 0 410.05 -173.655333717579 << change to 2 decimal places displayed 2225.37658

Re: using $. line number special variable (followup)

2004-11-10 Thread Joseph Paish
On Tuesday 09 November 2004 11:33, Paul Johnson wrote: > On Tue, Nov 09, 2004 at 11:40:30AM -0600, Joseph Paish wrote: > > BTW, i think i may have found out what is giving me the strange line > > numbers in the debugger under emacs. it seems that when i enter "p $." >

Re: using $. line number special variable (followup)

2004-11-09 Thread Joseph Paish
On Tuesday 09 November 2004 10:20, Christopher Maujean wrote: > On Tue, 2004-11-09 at 07:24, Joseph Paish wrote: > > just a short followup to my earlier message about the $. line number > > variable. when i enter a print statement as shown below, it prints the > > correct lin

Re: using $. line number special variable (followup)

2004-11-09 Thread Joseph Paish
On Tuesday 09 November 2004 08:41, Bob Showalter wrote: > Joseph Paish wrote: > > just a short followup to my earlier message about the $. line number > > variable. when i enter a print statement as shown below, it prints > > the correct line number (starting at 1), but s

Re: using $. line number special variable (followup)

2004-11-09 Thread Joseph Paish
/ /, $_ ; > # process intial values here > } > > if ($. > 1) { > #process subsequent values here > } > > } # end of while loop On Monday 08 November 2004 10:29, Joseph Paish wrote: > how do you use the "line number" variable insid

Re: using $. line number special variable

2004-11-08 Thread Joseph Paish
On Monday 08 November 2004 10:56, Bob Showalter wrote: > Joseph Paish wrote: > > how do you use the "line number" variable inside a while loop like i > > am trying to do below? > > > > i never get to process the first line of the file, and as a result, >

using $. line number special variable

2004-11-08 Thread Joseph Paish
how do you use the "line number" variable inside a while loop like i am trying to do below? i never get to process the first line of the file, and as a result, subsequent calculations are inaccurate. it always jumps to the second "if" statement. thanks joe = #!/usr/bin/perl use

Re: correct way to write my own packages

2004-06-18 Thread Joseph Paish
On Friday 18 June 2004 09:57, Randy W. Sims wrote: > Joseph Paish wrote: -- a bunch of stuff deleted > > i am using packages to break up a large piece of code into smaller pieces > > I'm not sure what you're trying to accomplish. If you are going to have > no subr

correct way to write my own packages

2004-06-18 Thread Joseph Paish
i am using packages to break up a large piece of code into smaller pieces so it is easier to maintain. the following piece of code works : -- this code loads the package #!/usr/bin/perl -w use strict ; # call the packaged code require '/path/to/package/PackageName.pl' ; PackageName

generate array of arrays from file

2004-03-16 Thread Joseph Paish
following the example in the perldsc (data structures cookbook), i wrote this piece of code to create an array of arrays from a data file : #!/usr/bin/perl -w use strict ; my @AofA ; # array of arrays of file contents open (fh1, ") { push @AofA, (split /\t/) ; } close (fh1) ; print $Aof

Re: error msg : can't use string as an ARRAY ref

2004-02-23 Thread Joseph Paish
luttering it up with stuff unrelated to the logic problem i was having. joe On Monday 23 February 2004 10:28, you wrote: > Joseph Paish wrote: > > < code snipped > > > :) Please use > > perl -c program > > to test program before posting. > > > synta

Re: error msg : can't use string as an ARRAY ref

2004-02-23 Thread Joseph Paish
--- several lines stripped out --- > > # everything works well up to here > > # what i want to do is loop through the sorted unique part numbers array > and print out all the array elements in @all_of_them that have a part > number that matches that unique value. i then move onto the next

error msg : can't use string as an ARRAY ref

2004-02-23 Thread Joseph Paish
#!/usr/bin/perl -w use strict ; use POSIX ; # i need POSIX for some calculations not shown here # variable declarations went here open (fh1, ") { push (@all_of_them, $_ ) ; # an array of all the records in the file my @single_line = split/ /, $_; push (@temp_array, $single_line[3])

Re: how to access certain values in hashes

2003-04-03 Thread Joseph Paish
On Thursday 03 April 2003 08:53, Joseph Paish wrote: > i have a hash that looks like this : > > abc => 123 456 789 246 346 8765 > deh => 123 456 258 246 346 8765 > nyx => 123 456 149 246 346 8765 > pob => 123 456 354 246 346 8765 > syt => 123 456 924 246 346 876

how to access certain values in hashes

2003-04-03 Thread Joseph Paish
i have a hash that looks like this : abc => 123 456 789 246 346 8765 deh => 123 456 258 246 346 8765 nyx => 123 456 149 246 346 8765 pob => 123 456 354 246 346 8765 syt => 123 456 924 246 346 8765 already sorted by the key (the first field above). i want to do some simple math based on the value

find last entry in a file

2003-02-20 Thread Joseph Paish
i have a data file that looks something like this : ( it is already sorted by date ) 12/22/02 abc 123 456 789 12/23/02 def 246 812 98234 12/24/02 ank 987 23456 8762 12/27/02 abc 987 345 65434 01/05/03 abc 876 2356 87 01/09/03 ank 875 234 98098 02/01/03 def 987 3453 456 02/05/03 ghi.th 987 2345 94

Re: how to delete space at end of line

2002-12-01 Thread Joseph Paish
On Friday 29 November 2002 14:28, you wrote: > Joseph Paish wrote: > > i have a data file that i am reading into an array. some of the data > > file entries have a space at the end of the line and some do not. is > > there some way that i can delete the space if it exists as

how to delete space at end of line

2002-11-29 Thread Joseph Paish
i have a data file that i am reading into an array. some of the data file entries have a space at the end of the line and some do not. is there some way that i can delete the space if it exists as i read each line (something like chomp deletes newlines if they exist)? preferably something leg

Re: copying files to diskette

2002-09-12 Thread Joseph Paish
thanks for the responses. still not working, but i will keep on plugging away or just use one of the scripts that already exist for doing backups and modify it for what i want. joe On Tuesday 06 August 2002 08:25, Joseph Paish wrote: > here is a copy of the script i am working on > &g