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 (Chris Stinemetz) wrote: > 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 Script for parsing EVDOPCMD data #### > 4 #### #### > 5 #### Always room for improvement 1/17/2011 #### > 6 > 7 use warnings; > 8 #use strict; > 9 use FileHandle; > 10 > 11 > 12 format RAW_TOP = > 13 @|||||||||||||||||||||||||||||||||||| > 14 "######--> Smart Phone report. <--######", > 15 Market ESN/MIN Mobile Cell Sector Bytes > 16 ====================================================================== > 17 . > 18 > 19 > 20 format RAW = > 21 @<<<<<<<< @|||||||||||||| @|||||||||||||| @|||||||| @|||||||| @||||||| > 22 $mkt,$mtype,$smartPhone,$cell,$sector,$rlptxat > 23 . > 24 > 25 # SmartPhone type Hash based on ESN or MEID HEX number > 26 my %smartPhone = ( > 27 "CURVE850" => { start => "a000001ca64E38", > 28 end => "a00000255c29c0", }, > 29 "KYOM6000" => { start => "a0000012b71b00", > 30 end => "a0000012fef1a0", }, > 31 "CURVE850" => { start => "ffffffff001388", > 32 end => "ffffffff001770", }, > 33 "Huawei" => { start => "a00000130fa7d0", > 34 end => "ffffffff001770", }, > 35 ); > 36 > 37 #### Market assignment Hash based on cell number > 38 my %marketInfo = ( > 39 MCI => { start => 1, > 40 end => 299, }, > 41 STL => { start => 300, > 42 end => 599, }, > 43 ICT => { start => 800, > 44 end => 850, }, > 45 ); > 46 > 47 sub getSmartPhone { > 48 > 49 my $val = shift; > 50 foreach my $k (keys %smartPhone) { > 51 my ($start, $end) = @{$smartPhone{$k}}{qw/start end/}; > 52 return $k if $start ge $val and $val le $end; > 53 } > 54 > 55 return ""; > 56 } > 57 > 58 > 59 sub getMarket { > 60 > 61 my $val = shift; > 62 foreach my $k (keys %marketInfo) { > 63 my ($start, $end) = @{$marketInfo{$k}}{qw/start end/}; > 64 return $k if $start <= $val and $val <= $end; > 65 } > 66 > 67 return ""; > 68 } > 69 open(RAW, ">test.rpt"); > 70 while (<>) { > 71 chomp; > 72 if (/;/) { > 73 @data = split /;/; > 74 if ($data[31] =~ m/^-?\d+$/) { #### regular expression for real > numerical value > 75 $mkt = getMarket($data[31]); > 76 } > 77 else > 78 { > 79 $mkt = ""; > 80 } > 81 > 82 if ( length($data[5]) > 12) { > 83 $smartPhone = getSmartPhone(substr($data[5],2,14)); > 84 } > 85 else > 86 { > 87 $smartPhone = ""; > 88 } > 89 > 90 > 91 ($mtype,$cell,$sector,$rlptxat) = > ($data[5],$data[31],$data[32],$data[44]); > 92 # print "$mkt\t $mtype\t $smartPhone\t $cell\t $sector\t > $rlptxat\n"; > 93 write(RAW); > 94 } > 95 } > 96 > 97 select(RAW); > 98 close(RAW); perlform is a distant memory but are you setting per the example in perlvar: HANDLE->format_lines_per_page(EXPR) $FORMAT_LINES_PER_PAGE $= The current page length (printable lines) of the currently selected output channel. Default is 60. Used with formats. (Mnemonic: = has horizontal lines.) See: perldoc perlvar In your case: use IO::Handle; ... RAW->format_lines_per_page(600); -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/