Re: parsing data from txt file

2010-12-27 Thread Uri Guttman
> "JH" == Jugurtha Hadjar writes: JH> Hello, JH> On 12/24/2010 06:45 PM, Uri Guttman wrote: >>> "JH" == Jugurtha Hadjar writes: >> JH> my @data =0; JH> my @fields =0; JH> my @val=0; >> >> that has to be wrong. that is setting the arrays to a list with the >> e

Re: parsing data from txt file

2010-12-27 Thread Jugurtha Hadjar
Hello, On 12/24/2010 06:45 PM, Uri Guttman wrote: "JH" == Jugurtha Hadjar writes: JH> my @data =0; JH> my @fields =0; JH> my @val=0; that has to be wrong. that is setting the arrays to a list with the element 0, not an empty list. Exactly. I tried to do something like m

Re: parsing data from txt file

2010-12-24 Thread Shawn H Corey
On 10-12-24 05:10 PM, John Delacour wrote: If you're going to an empty value (which is not necessary) Don't assume it's not necessary. At one time, mod_perl did not re-initialize the data space; it just reused it so you would get the previous values in your variables. Always initialize your

Re: parsing data from txt file

2010-12-24 Thread Uri Guttman
> "JD" == John Delacour writes: JD> On 24 December 2010 14:49, Jugurtha Hadjar wrote: >> I rewrote your code and at the very beginning, just before any variable was >> /used/ [i.e, just after "use strict", I added >> >> >> # Intialization begins >> >> my $cell        ='';

Re: parsing data from txt file

2010-12-24 Thread John Delacour
On 24 December 2010 14:49, Jugurtha Hadjar wrote: > I rewrote your code and at the very beginning, just before any variable was > /used/ [i.e, just after "use strict", I added > > > # Intialization begins > > my $cell        =''; > my $filename    =''; If you're going to an empty value (which is

RE: parsing data from txt file

2010-12-24 Thread Jim Gibson
At 10:44 AM -0700 12/24/10, Chris Stinemetz wrote: Okay I appreciate everyones help. I feel like i am getting closer. Below is my current code and error I get. Thank you all! 1 #!/usr/bin/perl 2 use warnings; 3 use strict; 4 5 # Intialization begins 6 7 my $cell=''; 8

Re: parsing data from txt file

2010-12-24 Thread Uri Guttman
> "CS" == Chris Stinemetz writes: CS> 5 # Intialization begins as i said elsewhere, don't declare vars before you need them. it is noisy and in many cases redundant. CS> 6 CS> 10 my $line=''; CS> 21 my @val= (split /:/, $line); what do you think that line does? $

RE: parsing data from txt file

2010-12-24 Thread Chris Stinemetz
;Cell;Sector\n"; 47 48 #For each record, print the data to the output file: 49 50print $out join(';',@data), "\n"; 51 52 close $out; What file do you want to parse?10121807.EVDOPCMD Can't use string ("") as a symbol ref while "strict refs"

Re: parsing data from txt file

2010-12-24 Thread Uri Guttman
> "JH" == Jugurtha Hadjar writes: JH> I rewrote your code and at the very beginning, just before any JH> variable was /used/ [i.e, just after "use strict", I added this is very overkill and in some cases wrong. in general declare variable just when they are needed. when i see a long list

RE: parsing data from txt file

2010-12-24 Thread Jim Gibson
At 8:55 PM -0700 12/23/10, Chris Stinemetz wrote: Jim, Thank you for your help! My perl program contains the following code. I am getting errors when I run the program. Any insight is greatly appreciated. I gave you some program fragments to help you get started. You are going to have to u

Re: parsing data from txt file

2010-12-24 Thread Shawn H Corey
On 10-12-24 09:49 AM, Jugurtha Hadjar wrote: my @data =0; my @fields =0; my @val=0; my @data = (); my @fields = (); my @val= (); -- Just my 0.0002 million dollars worth, Shawn Confusion is the first step of understanding. Programming is as much about organization and commu

Re: parsing data from txt file

2010-12-24 Thread Jugurtha Hadjar
Hello Chris, The variables aren't /initialized/ before they're used in this code.. So, something like print $out actually won't even know what the value of $out is in the first place, let alone write in it. You mentionned "processed.txt", but it was in a comment, not in the actual code.. And

Re: parsing data from txt file

2010-12-23 Thread Brandon McCaig
On Thu, Dec 23, 2010 at 10:55 PM, Chris Stinemetz wrote: >  1 #!/usr/bin/perl >  2 >  3 use warnings; >  4 use strict; >  5 >  6 #Get data from EVDOPCMD.txt file and output to processed.txt file. >  7 >  8 print "What file do you want to parse?"; >  9 $filename = ; >  10 >  11 open( my $in, '<', $

RE: parsing data from txt file

2010-12-23 Thread Chris Stinemetz
ame at ./smart_phone.pl line 12. Global symbol "$line" requires explicit package name at ./smart_phone.pl line 12. Global symbol "$out" requires explicit package name at ./smart_phone.pl line 12. ./smart_phone.pl has too many errors. Fr

Re: parsing data from txt file

2010-12-23 Thread Jim Gibson
At 12:18 PM -0700 12/23/10, Chris Stinemetz wrote: Hello, I hope someone can help me. I am trying to parse data from a txt file and output the results to a new file with timestamp in the name of the file. Look at the open function for reading existing files and creating new ones: perldoc

Re: parsing data from txt file

2010-12-23 Thread shawn wilson
On Dec 23, 2010 2:19 PM, "Chris Stinemetz" < cstinem...@cricketcommunications.com> wrote: > > Hello, > > I hope someone can help me. I am trying to parse data from a txt file and output the results to a new file with timestamp in the name of the file. > > The format of the txt file is ";" delimite