parsing data from txt file

2010-12-23 Thread Chris Stinemetz
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 ";" delimited and is several thousand records in length. Below is an example of the .txt format. PACE | EVDOP

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-24 Thread Chris Stinemetz
in use at ./smart_phone.pl line 30, line 1. ____ From: Jim Gibson [jimsgib...@gmail.com] Sent: Friday, December 24, 2010 10:20 AM To: beginners@perl.org Subject: RE: parsing data from txt file At 8:55 PM -0700 12/23/10, Chris Stinemetz wrote: >Jim, > >

problems hashing

2011-01-06 Thread Chris Stinemetz
Hello all, I am having problems using hash function. I would like to only extract 4 columns of data from a text file that is ; delimited. Below is my code along with the errors I am receiving. Any help is appreciated. -Chris 1. #!/usr/bin/perl 2. use warnings; 3. use stri

RE: problems hashing

2011-01-07 Thread Chris Stinemetz
18;43243423;01;;; Chris -Original Message- From: John Delacour [mailto:johndelac...@gmail.com] Sent: Thursday, January 06, 2011 2:16 PM To: beginners@perl.org Subject: Re: problems hashing At 11:25 -0700 06/01/2011, Chris Stinemetz wrote: &

RE: problems hashing

2011-01-07 Thread Chris Stinemetz
nk you for your help! Chris -Original Message- From: Brandon McCaig [mailto:bamcc...@gmail.com] Sent: Friday, January 07, 2011 10:19 PM To: Chris Stinemetz Cc: John Delacour; beginners@perl.org Subject: Re: problems hashing On Fri, Jan 7, 2011 at 10:51 PM, Chris Stinemetz wrote: >

RE: problems hashing

2011-01-08 Thread Chris Stinemetz
__ From: Jim Gibson [jimsgib...@gmail.com] Sent: Saturday, January 08, 2011 1:32 AM To: Chris Stinemetz; Brandon McCaig Cc: John Delacour; beginners@perl.org Subject: RE: problems hashing At 9:26 PM -0700 1/7/11, Chris Stinemetz wrote: >Thanks Brandon, > >Ultimately I am trying to take the

Creating output report with topheader

2011-01-15 Thread Chris Stinemetz
pl line 9, line 2. Use of uninitialized value $rlptxat in formline at ./io.pl line 9, line 2. Chris Stinemetz

Lines per page $= varible

2011-01-20 Thread Chris Stinemetz
I am having difficulty using $= correctly to change the number of lines per page. I would like to set it to 600 but can't seem to get $= =600 to work correctly. Any insight is greatly appreciated. Thank you, Chris Stinemetz 1 #!/usr/bin/perl 2 3 Smart Phone Perl Scrip

RE: Lines per page $= varible

2011-01-20 Thread Chris Stinemetz
That worked perfectly! Thank you very much! Chris Stinemetz -Original Message- From: C.DeRykus [mailto:dery...@gmail.com] Sent: Thursday, January 20, 2011 1:40 PM To: beginners@perl.org Subject: Re: Lines per page $= varible On Jan 20, 9:40 am, cstinem...@cricketcommunications.com

sorting report

2011-01-31 Thread Chris Stinemetz
I would like to sort my final report in the following order: $data[31],$data[32],$data[38] How would I add this into my following program to get the report sorted this way? Thanks in advance. Chris #!/usr/bin/perl use warnings; #use strict; use FileHandle; use IO::Handle; RAW->format_lines_

RE: sorting report

2011-02-01 Thread Chris Stinemetz
Shlomi, See far bottom for my updated code. Chris Stinemetz -Original Message- From: Shlomi Fish [mailto:shlo...@iglu.org.il] Sent: Tuesday, February 01, 2011 4:18 AM To: beginners@perl.org Cc: Chris Stinemetz Subject: Re: sorting report Hi Chris, a few comments on your code: On

RE: sorting report

2011-02-01 Thread Chris Stinemetz
I bottom posted. Any help is greatly appreciated. Chris -Original Message- From: Chris Stinemetz [mailto:cstinem...@cricketcommunications.com] Sent: Tuesday, February 01, 2011 8:03 AM To: Shlomi Fish; beginners@perl.org Subject: RE: sorting report Shlomi, See far bottom for my

x,y axis graph

2011-02-15 Thread Chris Stinemetz
I am interested in creating a cgi perl script that I can publish on the web that will tie into a mysql database and create a x,y axis graph based on data selection. Any suggestions are greatly appreciated. Thank you, Chris Stinemetz

sort results in ascending order

2011-03-16 Thread Chris Stinemetz
I would like to print results in ascending order starting with $cell, $sect, and finally $carr. I am getting the error: Name "main::a" used only once: possible typo at ./DOband.pl line 6. Name "main::b" used only once: possible typo at ./DOband.pl line 6. Below is my code. Any help is greatly a

RE: sort results in ascending order

2011-03-16 Thread Chris Stinemetz
Thanks, Where would I place print to see the results for validation? On 11-03-16 09:26 AM, Chris Stinemetz wrote: > I would like to print results in ascending order starting with $cell, $sect, > and finally $carr. You would need to store the data in a large array, then sort it. # un

RE: sort results in ascending order

2011-03-17 Thread Chris Stinemetz
Good day, Your help is greatly appreciated. Thanks For some reason I am not getting the sorted list in my output file. Instead I am getting the following: bc8) HASH(0x100d0d78) HASH(0x100d15e8) HASH(0x100d0f28) HASH(0x100d0c58) HASH(0x100d1168) HASH(0x100d1678) HASH(0x100d21 70) HASH(0x100d0ce

input file

2011-03-17 Thread Chris Stinemetz
#!/usr/bin/perl use warnings; use strict; my $filepath = "C://temp//PCMD"; my $outfile = "output.txt"; open ("$filepath") || die "ERROR: opening $filepath\n"; open (OUTFILE, "> $outfile") || die "ERROR: opening $outfile\n"; Chris Stinemetz

RE: input file

2011-03-17 Thread Chris Stinemetz
-Original Message- From: Rob Dixon [mailto:rob.di...@gmx.com] Sent: Thursday, March 17, 2011 10:37 AM To: beginners Cc: Chris Stinemetz Subject: Re: input file On 17/03/2011 15:56, Chris Stinemetz wrote: > > I'm trying to use file path for my file that I want to read but I a

if else elsif

2011-03-17 Thread Chris Stinemetz
[1] <=> $bb[1] or $aa[2] <=> $bb[2]; } @array; print $out "$_\n" foreach @array; close $out; #RTD 1 unit = 4 chips RUM Field 16 0 - 2^16 - 1 milliseconds Chris Stinemetz

sub routine

2011-03-17 Thread Chris Stinemetz
Thanks Chris I am trying to build a sub routine that computes the following equation When $data[262] has the value of 1 Take the value of $data[261] and return the solution of: $data[261]+13)/6.6/8/2*10)/10 When I call the sub routine before I push the array I would like to return the value in

Recall: sub routine

2011-03-17 Thread Chris Stinemetz
Chris Stinemetz would like to recall the message, "sub routine". -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

RE: sub routine

2011-03-17 Thread Chris Stinemetz
> >>>>> "CS" == Chris Stinemetz > writes: > CS> Thanks Chris > CS> I am trying to build a sub routine that computes the following > equation > CS> When $data[262] has the value of 1 > CS> Take the value

RE: sub routine

2011-03-18 Thread Chris Stinemetz
Thanks Uri. I've been reading perldoc perlsub and have a better understanding about subroutines, but I am still stuck. Any help is greatly appreciated. The error I am getting is: Global symbol "%record" requires explicit package name at ./DOband1.pl line 20. Global symbol "$line" requires expli

printf explicitly

2011-03-18 Thread Chris Stinemetz
Hello, I would like to explicitly use printf '<%.2g>' for the element in the array called dist. Below is the error I am getting and below that is a sample of the output I can currently generate before I add printf. Thank you Argument "2,1,1,1175,2.58522727272727,1\n" isn't numeric in printf at

File/Slurp module

2011-03-19 Thread Chris Stinemetz
Uri, When I try to parse one of my raw files I get the following error: Out of memory during "large" request for 536875008 bytes, total sbrk() is 880640 bytes at /usr/lib/perl5/site_perl/5.10/ File/Slurp.pm line 159. Since you created the File::Slurp module I was curious if you knew what the fi

foreach loop

2011-03-19 Thread Chris Stinemetz
I am trying to code a foreach loop, that will add all occurrences of the element rlptxat that have the same elements cell, sect and chan. My failed attempt can be located in between the ### lines. Below is what I have so far. Thank you in advance, Chris #!/usr/bin/perl use warnings; use stri

RE: foreach loop

2011-03-20 Thread Chris Stinemetz
So back to the question. How can I nest this foreach loop correctly to add all occurrences of the element rlptxat that have the same elements cell, sect and chan in the array? $record{rlptxat} = ( length($record{rlptxat})> 1 ) ? $record{rlptxat}{cell, sect, chan, dist}++ : '' ; Thank you very

RE: foreach loop

2011-03-20 Thread Chris Stinemetz
:58 PM To: beginners@perl.org Subject: RE: foreach loop At 8:31 AM -0600 3/20/11, Chris Stinemetz wrote: >So back to the question. How can I nest this foreach loop correctly >to add all occurrences of the element rlptxat that have the same >elements cell, sect and chan in the array? &

RE: foreach loop

2011-03-22 Thread Chris Stinemetz
d. I hope this helps Thank you, Chris At 8:03 PM -0600 3/20/11, Chris Stinemetz wrote: >Jim, > >Thanks for your feedback. I am actually trying to sum up all rlptxat >elements that have the same cell, sect, and chan elements in the >array. I hope this clarifies. No, it does

RE: foreach loop

2011-03-22 Thread Chris Stinemetz
Jim, You hit it right on. This is exactly what I am trying to do. > OK. With this information and that from previous posts, your requirements may > be summaryized as follows: > You have a file with one record per line, each line consisting of a number of > fields. Within each record may be fou

RE: foreach loop

2011-03-23 Thread Chris Stinemetz
Thanks Jim, I am still unable to sum up the field $rlptxat. The error I am getting is below: Scalar found where operator expected at ./jim.pl line 52, near "$sum" (Missing semicolon on previous line?) "my" variable %sum masks earlier declaration in same scope at ./jim.pl line 54. "my" va

RE: foreach loop

2011-03-23 Thread Chris Stinemetz
That worked! Thanks Jim. Chris -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

RE: foreach loop

2011-03-23 Thread Chris Stinemetz
Jim, I have another question. How do I sort the results so it is from smallest to largest starting with $cell,$sect,$carr? Thanks again for all you help. I am gaining a much better understanding. This is what I got: #!/usr/bin/perl use warnings; use strict; #my $filepath = 'C:/temp/PCMD';

RE: foreach loop

2011-03-24 Thread Chris Stinemetz
Thanks again Jim! I have one more question..lol I appreciate all your help! I would like $dist be part of the print statement, but I am not sure how to code it correctly. I am getting the following error: Global symbol "@dist" requires explicit package name at ./jim.pl line 38. Execution of

ternary operator

2011-03-24 Thread Chris Stinemetz
I have a ternary operator that I would like to be rounded to the nearest tenth decimal place before the array is pushed. For example: I would like the current output of my ternary operator: 2.44318181818182 to be rounded to 2.4. Below is what my code looks like: #!/usr/bin/perl use warnings

Re: foreach loop

2011-03-24 Thread Chris Stinemetz
Jim, I am getting really close to finishing up this program. perl is lot's of fun and I appreciate all your help! The output is giving me the data I am looking for except for the following issues: How would I add the correct code to make sure the array has a numeric value before the loop iterati

Re: foreach loop

2011-03-25 Thread Chris Stinemetz
Thanks Rob. That seems to have done the trick. I understand this is a for loop, but do you mind breaking it down line by line so I fully understand what it is doing? Thank you, Chris > >  for my $i (44..47) { >    my $rlp = $data[$i]; >    $sum{$cell}{$sect}{$carr}{$dist} += $rlp if $rlp; >  } >

Re: ternary operator

2011-03-25 Thread Chris Stinemetz
I am getting the warning: Argument "" isn't numeric in numeric lt (<) at ./DOband.pl line 22, <$fh> line 52411. It seems to be directed to the below ternary operator: How can I include in the ternary to ignore all non numeric values in the elements $cell and $chan? my $carr =

Re: ternary operator

2011-03-25 Thread Chris Stinemetz
There is no possible value of 0 for what I am trying to do. So I am trying to do the former example: >if( $cell ) { I am trying to code the if statement correctly, but I am getting a syntax error: Below is how I am trying to code the if statement: if ($cell >= 1 && $cell <= 900 ) {

Re: ternary operator

2011-03-26 Thread Chris Stinemetz
> > In the statement: > >    if( $cell ) > > $cell is evaluated for true or false. All scalar values are valid in this > evaluation, including numerical, string, and undef, the three types of Perl > scalar values. > > On the other hand, in this statement: > >    if( $cell >= 1 && $cell <= 900 ) { .

RE: ternary operator

2011-03-26 Thread Chris Stinemetz
Jim, Thank you for the clarification and the "perl -c yourprogram.pl" tip. It works the way I want it to now. You have been very helpful. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: ternary operator

2011-03-28 Thread Chris Stinemetz
I would like to make an adjustment to this ternary operator. Instead of returning 0 if length( $dist ) is not > 1. I would like to return the last $dist value incremented by 0.1 mile so there is no gap of more than 0.1 miles. $dist = sprintf "%.1f", ( length( $dist ) > 1 ) ? $dist/6.6/8/2*10/10 :

reformating input file

2011-05-17 Thread Chris Stinemetz
I have an input csv file which data looks like the following: csno,svgrp,antfc,cdmanbr_list1.ncs_c,cdmanbr_list1.nghbrantf,cdmanbr_list1.pgn_c ,cdmanbr_list1.bandclass,cdmanbr_list1.anbeaplt,cdmanbr_list1.nghb_conf,cdmanbr_ list1.hdhandoff 871,0,1,871,2,0,1900,n,0,n 871,0,1,871,3,1,1900,n,0,n 871

Re: reformating input file

2011-05-17 Thread Chris Stinemetz
Correction > u > csno=871 > svgrp=0 > antfc=1 > cdmanbr_list1.ncs_c[1]=871 > cdmanbr_list1.nghbrantf[1]=2 > cdmanbr_list1.pgn_c[1]=0 > cdmanbr_list1.bandclass[1]=1900 > cdmanbr_list1.anbeaplt=n > cdmanbr_list1.nghb_conf=0 > cdmanbr_list1.hdhandoff=n > u > EXIT > > > u > csno=871 > svgrp=0 > antfc=

Re: reformating input file

2011-05-17 Thread Chris Stinemetz
Last correction > > csno,svgrp,antfc,cdmanbr_list1.ncs_c,cdmanbr_list1.nghbrantf,cdmanbr_list1.pgn_c > ,cdmanbr_list1.bandclass,cdmanbr_list1.anbeaplt,cdmanbr_list1.nghb_conf,cdmanbr_ > list1.hdhandoff > 871,0,1,871,2,0,1900,n,0,n > 871,0,1,871,3,1,1900,n,0,n > 871,0,1,872,1,0,1900,n,0,n > 871,0,1

RE: reformating input file

2011-05-17 Thread Chris Stinemetz
> In the actual file, is the first record really spread out over three lines, > or is that just the result of line-wrapping in your email message? The first three lines can be omitted they will not be included in the input file. And yes it was wrapped by my email. Sorry about that. > > For t

concatenate a hash key

2011-05-18 Thread Chris Stinemetz
I have a hash table: my %formInstance = ( "Cell" => "csno", "Servgrp" => "svgrp", "Sector" => "antfc" ); While I am iterating through the rows of the input data how can I concatenate a hash key as the first three fields? (i.e. 871-0-1) In

XAMPP

2011-08-04 Thread Chris Stinemetz
I'm thinking about testdriveing XAMPP. Does anyone have any opinions on the product? Good or bad? http://www.apachefriends.org/en/xampp.html Thank you, Chris -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org

beginners@perl.org

2011-09-05 Thread Chris Stinemetz
In exercise 3-3 from the lama book. How do you make sure the user enters a number 1 thru 7? The simple program is: #!/usr/bin/perl use warnings; use strict; my @names = qw/ fred betty barney dino wilma pebbles bamm-bamm /; print "Enter some numbers from 1 to 7, one per line, then press Ctrl-Z:\n

Re:

2011-09-05 Thread Chris Stinemetz
> > I should also note that one would use Ctrl+D instead of Ctrl+Z for EOF in > UNIX-land. > Thank you Shlomi. I am currently in the windows-land. I was not aware of the warn function. Learn something new everyday! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands

perl help

2011-09-08 Thread Chris Stinemetz
What would be the best way to omit any record when varible $dist is null or not > 1 ? I am not sure my attempt is correct with the ternary operator with length function. It seems that $dist is just being assinged 0 when the expression $dist is not > 1. Any help is greatly appreciated. Thank you,

Re: perl help

2011-09-09 Thread Chris Stinemetz
> >> What would be the best way to omit any record when varible $dist is >> null or not>  1 ? > > But from your code, I assume you mean to omit records when the _length_ > of $dist isn't greater than one? > > I would make the check immediately $dest is assigned, and 'next' over > the record in the

Re: Help, About Global variable.

2011-09-13 Thread Chris Stinemetz
> >> ...For more information see: >> >> http://perl.plover.com/FAQs/Namespaces.html > > Useful article. > > Now can you explain why I get no error with this little routine? - > >        #!/usr/local/bin/perl >        use strict; >        $a = 1; >        $b = 2; >        print qq($a, $b\n); > >Fro

Re: website vs web app

2011-09-16 Thread Chris Stinemetz
On Fri, Sep 16, 2011 at 6:10 PM, Rajeev Prasad wrote: > why do i need a web app? becuase of size of my project? I mean if it is going > to be  a very big website with lot of pages and tables etc. should i have a > webapp? > > apache and cgi wont cut it? (alongwith other technologies used commonl

Learning Perl ex8-5

2011-09-26 Thread Chris Stinemetz
I am having some difficulty completing this exercise from llama book. Maybe someone can explain memory variables to me when working with regular expressions. The exercise: Modify the program from the previous exercise so that immediately following the word ending in "a" it will also capture up

pattern matching regex

2011-09-27 Thread Chris Stinemetz
Trying to match the what is contained in $what 3 consecutive times. But I am getting the followoing error: Use of uninitialized value $_ in pattern match (m//) at ./ex9-1.pl line 7. The program: #!/usr/bin/perl use warnings; use strict; my $what = 'fred|barney'; if (/($what){3}/) { print $wha

explicit package name

2011-10-03 Thread Chris Stinemetz
Can someone tell me why I am getting the following error? Global symbol "$quess" requires explicit package name at ./ex10-1.pl line 18. Execution of ./ex10-1.pl aborted due to compilation errors. I declare $guess inside the while loop. Shouldn't that suffice for the rest of the scope? Thank you,

Re: explicit package name

2011-10-03 Thread Chris Stinemetz
> > You have correctly declared the variable $guess, but you are using > $quess here, which doesn't exist. That is the sort of thing 'use strict' > is good at finding for you! > Oh my goodness! Maybe that is a sign it is time to call it a night! Thanks all! Not sure why I couldn't see that. Chri

smart matching

2011-10-05 Thread Chris Stinemetz
trying to learn smart matching in an exercise. Why does this program output "odd" when I input an even number? Thank you, Chris #!/usr/bin/perl use warnings; use strict; use 5.010; say "Checking the number <$ARGV[0]>"; my $favorite = 62; given( $ARGV[0] ) { when( ! /^\d+$/ ) { say

regex help

2011-10-10 Thread Chris Stinemetz
Any help is appreciated. Once I match HEH how can alter the program to print the contents that are in the two lines directly above the match? For example in this case I would like the print results to be: **01 REPT:CELL 983 CDM 1, CCU 1, CE 5, HEHTimestamp: 10/10/11 00:01:18 #!/usr/bin/per

setting format explicitly

2011-10-11 Thread Chris Stinemetz
I am currently just trying to build my table structure for this program. I am getting the following error: Any help in resolution or advice is greatly appreciated. $ ./heh.pl Can't locate object method "format_name" via package "RAW" (perhaps you forgot to load "RAW"?) at ./heh.pl line 39, <$fh

Updating Perl without admin

2011-10-12 Thread Chris Stinemetz
Is it possible to install updated version of Perl in a unix environment without admin prevliges? Thank you, Chris

Re: Updating Perl without admin

2011-10-12 Thread Chris Stinemetz
>> Is it possible to install updated version of Perl in a unix environment >> without admin prevliges? > > Yes, use perlbrew:  http://www.perlbrew.pl/ > >From CPAN: To use perlbrew, it is required to install curl or wget first. perlbrew depends on one of this two external commmands to be there in

stuck and need some direction

2011-10-14 Thread Chris Stinemetz
Hello, I am trying to create a Perl script that will scan a file using regex to match certain patterns and return uniq names and the total count of each match. With the sample input data (on the far bottom) the return value should be CELL 20 in Column 1 with 2 Counts of CDM HEH in the third colum

Re: stuck and need some direction

2011-10-15 Thread Chris Stinemetz
On Sat, Oct 15, 2011 at 1:12 PM, Leo Susanto wrote: > Chris, You need to let us know what do you want the script to do, > believe me, writing the script is the easy part. > Okay I will try to clarify. For right now there is only one type of line that I am interested in from the input file. I wi

Re: stuck and need some direction

2011-10-15 Thread Chris Stinemetz
Thank you everyone for your suggestions. They were very helpful! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: stuck and need some direction

2011-10-16 Thread Chris Stinemetz
On Sat, Oct 15, 2011 at 2:40 PM, Leo Susanto wrote: > use strict; > my %CELL; > my %CELL_TYPE_COUNT; > while (my $line = ) { >        if ($line =~ /CELL\s+(\d+)\s+(.+?),.+?HEH/) { # take CELL number into > $1 and the information after the number (and before the first comma) > into $2 >            

Re: stuck and need some direction

2011-10-16 Thread Chris Stinemetz
> > Well, the problem with perlform is: it expects a certain number of column. > > My question to you is: is the number of cell type constant or is it > indeterminate? > > If it's indeterminate then it's better to stick with print, or printf > if you want some formatting. Cell is indeterminate. Al

regex help

2011-10-17 Thread Chris Stinemetz
Hello, I am getting the following error when I am trying to use regex to match a pattern and then access the memory variables: Any insight as to what I am doing wrong is greatly appreciated. Thank you, Chris Use of uninitialized value $1 in hash element at ./heh.pl line 22, <$fh> line 1211. Us

Re: regex help

2011-10-18 Thread Chris Stinemetz
On Mon, Oct 17, 2011 at 10:57 PM, Leo Susanto wrote: > From looking at the regex > >>  if ($line =~ >> /17|18|19|20|21+:(\d+):(\d+)+\n+\n+CELL\s+(\d+)\s+(.+?),.+?HEH/){ > > against the data > >> 10/17/11 18:25:20 #578030 >> >>  25 REPT:CELL 221 CDM 2, CRC, HEH >>     SUPPRESSED MSGS: 0 >>     ERR

Re: regex help

2011-10-28 Thread Chris Stinemetz
On Wed, Oct 19, 2011 at 1:10 AM, Leo Susanto wrote: > use strict; > my %CELL; > my %CELL_TYPE_COUNT; > my $timestamp; > my $hour; > while (my $line = ) { >if ($line =~ m|\d{1,2}/\d{1,2}/\d{2} ((\d{1,2}):\d{1,2}:\d{1,2})|) { > #10/17/11 18:25:20 #578030 >$timestamp = $1; >

regex

2011-11-04 Thread Chris Stinemetz
I am trying to match a line that has HEH in it. I would also like to store the number follow CELL in memory variable $1 and store everything following the number and upto excluding ", HEH" in memory variable $2 so this line: Cell 999 CDM 1, 2, CBR 1, 15MHz, HEH will equal: $1 = 999 $2 = CDM 1,

Re: regex

2011-11-04 Thread Chris Stinemetz
> > > > Try this: > > "Cell 999 CDM 1, 2, CBR 1, 15MHz, HEH" =~ /Cell\s*(\d+)\s*(.*),\s*HEH/; > print "<$1> <$2>\n"; > > Thank you Jim. This did the trick! Do you mind explaining how you did this? I'm trying to make sense of it with my perl regex cheat sheet I found online. http://www.erudil.com

Re: regex

2011-11-04 Thread Chris Stinemetz
Sorry for the duplicate Jim. I meant to reply all on the original. On Fri, Nov 4, 2011 at 3:33 PM, Chris Stinemetz wrote: > > > >> I don't think I could improve on the extended regex with comments posted >> by >> Shawn H. Corey. His regex is the same as mine,

complex data structure

2011-11-06 Thread Chris Stinemetz
I would like to join the key from %cell hash to %cbr hash the dump from %cell hash looks like: '65' => { 'CDM 1, 2, CBR 3, 15MHz' => 2 }, and the dump from %cbr looks like: $VAR1 = { '1' => 223, }; So that %cbr becomes: '65'=>{

Re: complex data structure

2011-11-13 Thread Chris Stinemetz
How can I iterate over this three level hash printing the results as Hour\tCell\tHEH_Type\HEH_Count $VAR1 = { '00' => { '875' => { 'CDM 1, CCU 1, CE 5' => '1' }, '13' => {

Re: complex data structure

2011-11-14 Thread Chris Stinemetz
Thank you Shlomi. For some reason my final value for the keys is being repeated 24 times so I am guessing I have an issue with how I am iterating over the hashes. I can't seem to find the correct way to fix it so the value displays once. Any help is greatly appreciated. An example of the output

using require "file.txt"

2011-11-22 Thread Chris Stinemetz
I am working on a Perl script that is getting quite lengthy so I thought I would put the sub routines, hashes, and arrays in a seperate script from the main. The program will run when I turn use strict off in the main script, but when I turn it on the main script doesn't recognize the hash and arr

sprintf function

2011-11-29 Thread Chris Stinemetz
How can I check that the value assigned to $cell and $sector is numeric before I try to call the sprintf function? I am just trying to clear this warning. Argument "" isn't numeric in sprintf at ./rt_evdo_pcmd.pl line 139, <$FIN> line 119503. line 139 is from my program is below: my $c_s = spr

subroutine call

2011-12-04 Thread Chris Stinemetz
I have a program that I am working on improveing. The fist step I have taken is converting it in using the strict pragma. Now when this subroutine call is made I get the following compilation error: Global symbol "$cell" requires explicit package name at ./evdo.pl line 279. Global symbol "$cell"

uninitialized value

2011-12-07 Thread Chris Stinemetz
after converting an older Perl script to using strict pragma I am getting the follow error: I can't seem to figure out how to resolve this. I'm in hopes that there is someone that can let me know what I am missing? Thank you in advance! Chris Use of uninitialized value in numeric eq (==) at ./

Re: uninitialized value

2011-12-07 Thread Chris Stinemetz
Thanks John and Ken. Your advice helped me figure out the problem. Take care, Chris

split function

2011-12-13 Thread Chris Stinemetz
I am trying to split the first element of an array by white space then continue reading the rest of the file. Thus far I am having trouble figuring out how to split the first line. I would like the first line to be split so it looks like the following with the "=" sign added. Thank you in advance

Re: split function

2011-12-15 Thread Chris Stinemetz
I'm getting a bit closer. There a couple roadblocks I am up against. I am able to split the lines by white space, but for some reason the program isn't capturing the first lines to the @fieldValue array after the @headerNames array. Once I get all the lines to go into the array correctly I would l

Re: split function

2011-12-15 Thread Chris Stinemetz
On Thu, Dec 15, 2011 at 10:42 AM, Dr.Ruud wrote: > On 2011-12-14 05:43, Chris Stinemetz wrote: > >> I am trying to split the first element of an array by white space then >> continue reading the rest of the file. >> Thus far I am having trouble figuring out how to split t

Re: split function

2011-12-15 Thread Chris Stinemetz
> > Tool completed successfully > Thank you Rob! This is what I was trying to accomplish. I'm going to have to research to find out exactly what you did. Thanks agian, Chris -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http:

Re: split function

2011-12-15 Thread Chris Stinemetz
> > Is that your company's policy, or do you just lack root access? If it's the > latter, then see the various resources at http://perl-begin.org/topics/cpan/ , > so you can see how to install Perl modules from CPAN under your home > directory. > It isn't a company policy just circumstance. The u

Re: Replace words in a file using perl script

2011-12-16 Thread Chris Stinemetz
Hello Melvin, Give this a try. I used the advice Jim gave and this is what I came up with. It seems to do what you are asking for. #!/usr/bin/perl use warnings; use strict; my $inFile = "input.txt"; my $outFile = "output.txt"; open my $fin, '<', $inFile or die "ERROR opening $inFile: $!"; open

Re: split function

2011-12-16 Thread Chris Stinemetz
> > However I think it's more likely that you need /all/ of the data to be > output, so I suggest something like my program below. > > HTH, > > Rob > > > use strict; > use warnings; > > my @headers; > > while () { >  if (@headers) { >    my @data = split; >    for my $i (0 .. $#headers) { >      pr

Re: Help in search concept

2011-12-20 Thread Chris Stinemetz
> > I am a learner in Perl and this is my first post in this group. I need to > search a word "Test 1.2.1" in my file. I am using "$_ =~m/Test \d+", but it > searched only "Test 1" not the full content. I need to check whether it is > "Test 1" or "Test 1.2" or "Test 1.2.1". Kindly help me in this r

parsing data

2011-12-20 Thread Chris Stinemetz
Hello list, I am having some trouble coming up with a solution for what I am trying to accomplish. Any advice is greatly appreciated. A sample of the data I would like to parse is below: I am trying to build a table like structure where the string to the left of the "=" sign is the header and t

Re: parsing data

2011-12-21 Thread Chris Stinemetz
I'm trying to implement the advice that Binish, and John gave. I am getting the following error: Can't use an undefined value as a HASH reference at ./format.pl line 16, line 2. Any help is greatly appreciated, Chris #!/usr/bin/perl use warnings; use strict; my $csno; while( ) { chomp;

Re: Hello a question about ".+?"

2011-12-29 Thread Chris Stinemetz
On Thu, Dec 29, 2011 at 1:17 PM, Xi Chen wrote: > Hello everyone, > > I have a question about how to translate the meaning of ".+?". Please > see the examples below: > SASI_Hs01_00205058      HUMAN   NM_005762       857     MISSION¬Æ siRNA 2     >                    140.00 > I want to get number"

Re: What does "=<" means?

2011-12-29 Thread Chris Stinemetz
On Thu, Dec 29, 2011 at 9:26 PM, Xi Chen wrote: > Hello everyone, > > I saw a code below to get two same letters "p" in @a. > > @a = qw (D D p O H p A O); > foreach $b (@a){ > $n =~ /$b/i; > if($n >= 2){ >     $m = $b; >    } > } > > But I don't know what does ">=" mean. Thank you! > It is just g

array uniq elements

2012-01-08 Thread Chris Stinemetz
How do I extract uniq elements from an array? Basically I want to preserve the order of the elements as they are first seen, but I would like to remove any duplicates. Below is what I have so far. Thank you in advance. Chris #!/usr/bin/perl use warnings; use strict; use Data::Dumper; my @head

Re: array uniq elements

2012-01-09 Thread Chris Stinemetz
Thank you Jim. Your advice worked perfectly. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

comparing arrays

2012-01-11 Thread Chris Stinemetz
I have a script where I have captured the value on the left side of the "=" as the header for my table. Now I want to take the value on the right side of the "=" sign and populate a new row in table format where the header value I stored in the @header array matches the value on the left side of th

Re: comparing arrays

2012-01-12 Thread Chris Stinemetz
Thanks for your advice Jim. Although it makes very good sense to me, I am having a little difficult implementing it. I will have to admit referencing is still a bit foreign to me. I am getting the following error and I am not sure how to fix it. Type of arg 1 to push must be array (not reference

Re: comparing arrays

2012-01-12 Thread Chris Stinemetz
Thank you Jim. That got me over that hurdel! Any advice on how to maintain the order of elements in the @header array and print the value to the right of the "=" sign for each dataset, and if there is a value in the dataset that doesn't match the element in the @header simply leave the value blank

  1   2   >