[28197] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 9561 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 4 14:05:55 2006

Date: Fri, 4 Aug 2006 11:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 4 Aug 2006     Volume: 10 Number: 9561

Today's topics:
    Re: Get name of user invoking program? <glennj@ncf.ca>
    Re: How probably not to hand over a variable from one p <tzz@lifelogs.com>
    Re: How probably not to hand over a variable from one p <nospam-abuse@ilyaz.org>
    Re: How probably not to hand over a variable from one p <rvtol+news@isolution.nl>
    Re: Perl hash of hash efficiency. anno4000@radom.zrz.tu-berlin.de
    Re: Perl hash of hash efficiency. anno4000@radom.zrz.tu-berlin.de
    Re: Perl hash of hash efficiency. <1usa@llenroc.ude.invalid>
    Re: Perl hash of hash efficiency. <nospam-abuse@ilyaz.org>
    Re: Perl script does nt parses d entire excel file plea <mumia.w.18.spam+nospam.usenet@earthlink.net>
    Re: Perl script does nt parses d entire excel file plea <mritty@gmail.com>
    Re: Perl script does nt parses d entire excel file plea <DJStunks@gmail.com>
    Re: Perl script does nt parses d entire excel file plea <jgibson@mail.arc.nasa.gov>
    Re: Printing "" and $iIN <glex_no-spam@qwest-spam-no.invalid>
        Reading value from File and using in another file vedpsingh@gmail.com
    Re: Reading value from File and using in another file <mritty@gmail.com>
    Re: Reading value from File and using in another file <1usa@llenroc.ude.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 4 Aug 2006 13:05:06 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: Get name of user invoking program?
Message-Id: <slrned6hg2.ed0.glennj@smeagol.ncf.ca>

At 2006-08-04 08:18AM, Justin C <justin.0511@purestblue.com> wrote:
>  
>  Probably an FAQ. I need to get the user name of who has invoked the
>  program. perldoc -q user doesn't show anything relevant, but perldoc -q
>  uid gives $< ... which gives the numerical id of the user. I need to get
>  the name from this. Is there a straightforward way of doing this or do I
>  have to grep /etc/passwd? ... or is there another way?

     my $name = getpwuid $<

-- 
Glenn Jackman
Ulterior Designer


------------------------------

Date: Fri, 04 Aug 2006 11:21:14 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: How probably not to hand over a variable from one perl script to another
Message-Id: <g69y7u48r2t.fsf@CN1374059D0130.kendall.corp.akamai.com>

On  3 Aug 2006, axel@white-eagle.invalid.uk wrote:

Ted Zlatanov <tzz@lifelogs.com> wrote:
>> Finally, do NOT write your file as executable code so you can then run
>> eval() on it.  Bad idea, even for advanced programmers.
>
> I am curious as to why this is a bad idea. I would have thought that
> using Data::Dumper to save data and then eval'ing it would be the idea
> solution for passing such things as arrays and hashes.

Because it takes a lot of intelligent understanding, planning, and
prevention to make sure you're not vulnerable to a security breach
that way.  I'm not just talking about a system("rm -rf /") call
inserted in your data, but more insidious things like keyloggers.

Your data is also locked to Perl.  You'll find it very hard to share
data with another language later if you use Data::Dumper.

Data::Dumper may also save data you don't want saved, e.g. a password
in a data structure you didn't know you were dumping.

Pass data with a data language.  I suggested YAML or XML - there are
many others.

Ted


------------------------------

Date: Fri, 4 Aug 2006 15:36:23 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: How probably not to hand over a variable from one perl script to another
Message-Id: <eavphn$2fm$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Ted Zlatanov 
<tzz@lifelogs.com>], who wrote in article <g69y7u48r2t.fsf@CN1374059D0130.kendall.corp.akamai.com>:

[[Discussion of using Data::Dumper for serialization as being a lunacy
  omitted due to a complete agreement. ;-]]

> Data::Dumper may also save data you don't want saved, e.g. a password
> in a data structure you didn't know you were dumping.
> 
> Pass data with a data language.  I suggested YAML or XML - there are
> many others.

Ted, I think the last objection is misplaced.  Data language wouldn't
help if you have some data you don't want saved...

And, of course, now there are builtin *quick* serialization methods.

  perldoc Storable

Hope this helps,
Ilya


------------------------------

Date: Fri, 4 Aug 2006 14:30:31 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: How probably not to hand over a variable from one perl script to another
Message-Id: <eavlqn.194.1@news.isolution.nl>

Markus Hänchen schreef:

> Perl is such a wonderful language, in that almost always does
> something whatever you code, not always what you want or expect,

There is a Perl cheat sheet:
http://juerd.nl/site.plp/perlcheat
http://www.xs4all.nl/~rvtol/perl/Perl5_cheat.pdf

-- 
Affijn, Ruud

"Gewoon is een tijger."




------------------------------

Date: 4 Aug 2006 13:20:15 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Perl hash of hash efficiency.
Message-Id: <4jgvsfF81t5rU1@news.dfncis.de>

 <xhoster@gmail.com> wrote in comp.lang.perl.misc:
> "tak" <yekasi@gmail.com> wrote:

[...]

> > Say I have the key of subhash, as $letter, and the item in subhash as,
> > $value.
> >
> > delete $hoh{$letter}{$value};
> >
> > This should delete that from the hash, right?
> 
> Yes.
> ...

I find the question too vague to be answered unconditionally.

It deletes the entry associated with the key $value in the anonymous
hash $hoh{$letter}.  It does not delete anything from %hoh, even if
the entry $value was the last one in $hoh{$letter}.  That may or may
not matter for the program, but in another part of the thread the OP
seemed to expect the outer entry to go away.  It doesn't without
help from the programmer.

Anno


------------------------------

Date: 4 Aug 2006 13:46:17 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Perl hash of hash efficiency.
Message-Id: <4jh1d9F819g5U1@news.dfncis.de>

Ben Morrow  <benmorrow@tiscali.co.uk> wrote in comp.lang.perl.misc:
> 
> Quoth "tak" <yekasi@gmail.com>:
> > 
> > xhoster@gmail.com wrote:
> > > "tak" <yekasi@gmail.com> wrote:
> > > > Hi,
> > > >
> > > > I have a script, that loads a txt file, with 240k lines in it to a hash
> > > > currently. And when it loads the data to the hash - it becomes slower
> > > > and slower when it reaches may be around 150k
> > >
> > > How much memory do you have?  How much are you using at this point?
> > 
> > >From looking at the PF Usage - it is about 1.9 GB. on a 1gb machine -
> > the available physical memory are down to about 10 MB when loading...
> > But the CPU usage remains about 5% only...
> 
> So, you are thrashing. You've run out of memory: I would suggest using
> one of the DBM modules, probably DB_File. This stores the contents of
> the hash in a (structured, binary, fast-to-index) file on disk, which
> will probably make things faster.

But should it grow to almost two GB in the first place?  We have no
idea how long the OPs lines are, but assuming something ordinary like
80 bytes that's a bit over 18 MB.  Even Perl shouldn't blow it up
that much.  Or is some other memory hog running?  It sounds like the
program isn't doing much except reading the data.  That shouldn't
bring a two-gig machine down, unless the lines are much longer,
(about 8 KB) of course.

Anno


------------------------------

Date: Fri, 04 Aug 2006 15:12:30 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl hash of hash efficiency.
Message-Id: <Xns9815721D8270Aasu1cornelledu@127.0.0.1>

anno4000@radom.zrz.tu-berlin.de wrote in
news:4jh1d9F819g5U1@news.dfncis.de: 

> Ben Morrow  <benmorrow@tiscali.co.uk> wrote in comp.lang.perl.misc:
>> 
>> Quoth "tak" <yekasi@gmail.com>:
>> > 
 ...
>> > > "tak" <yekasi@gmail.com> wrote:
>> > > > I have a script, that loads a txt file, with 240k lines in it
>> > > > to a hash currently. And when it loads the data to the hash -
>> > > > it becomes slower and slower when it reaches may be around 150k
 ...
>> > >From looking at the PF Usage - it is about 1.9 GB. on a 1gb
>> > >machine - 
>> > the available physical memory are down to about 10 MB when
>> > loading... But the CPU usage remains about 5% only...
>> 
>> So, you are thrashing. You've run out of memory:
 ...
> But should it grow to almost two GB in the first place?  We have no
> idea how long the OPs lines are, but assuming something ordinary like
> 80 bytes that's a bit over 18 MB.  Even Perl shouldn't blow it up
> that much.  Or is some other memory hog running?  It sounds like the
> program isn't doing much except reading the data.


Since the OP did not post code, there is no way to know, but I am going to 
speculate that he might be slurping or even slurping many times and/or 
creating many copies of the data or something else along those lines.

For reference, I used a web server access log:

D:\UseNet\clpmisc\large> wc -l -L log.txt
   87499    32796 log.txt

D:\UseNet\clpmisc\large> dir log.txt
08/04/2006  10:54 AM        10,201,026 log.txt

D:\UseNet\clpmisc\large> cat readhash.pl
#!/usr/bin/perl

use strict;
use warnings;

my ($input) = @ARGV
    or die "Provide an input file name\n";

open my $input_fh, '<', $input
    or die "Cannot open '$input': $!";

my %table;

while ( <$input_fh> ) {
    my @words = split /\s+/;
    $table{ $_ } = [ @words ];
    print "$. ..." unless $. % 100;
}

print "Done\n";

sleep 100;

__END__

Note that this is awfully wasteful ... There is at least one key that is 
32K in length.

In Windows XP task manager, memory usage was reported as 82,380K

So, I can't really see reading and processing 240 thousand lines eating up 
2G. unless memory was already close to being exhausted when the OP first 
ran his script.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



------------------------------

Date: Fri, 4 Aug 2006 15:30:38 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Perl hash of hash efficiency.
Message-Id: <eavp6u$2ao$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to

<anno4000@radom.zrz.tu-berlin.de>], who wrote in article <4jh1d9F819g5U1@news.dfncis.de>:
> > > > > I have a script, that loads a txt file, with 240k lines in it to a hash

> > So, you are thrashing. You've run out of memory: I would suggest using
> > one of the DBM modules, probably DB_File. This stores the contents of
> > the hash in a (structured, binary, fast-to-index) file on disk, which
> > will probably make things faster.

> But should it grow to almost two GB in the first place?  We have no
> idea how long the OPs lines are, but assuming something ordinary like
> 80 bytes that's a bit over 18 MB.  Even Perl shouldn't blow it up
> that much.  Or is some other memory hog running?  It sounds like the
> program isn't doing much except reading the data.  That shouldn't
> bring a two-gig machine down, unless the lines are much longer,
> (about 8 KB) of course.

Note that hashes are quite memory-hungry (I would say circa 80bytes
per key total overhead - with a very good malloc() implementation).
So with a VERY LOUSY malloc() implementation (e.g., one which has 4K
minimal allocation unit), it could allocate two 4K chunks per key -
one for key, another for value.  This is exactly 8K of your calculation.

And I actually SAW such malloc()s widely used - some kind of debugging
tool which would put all chunks on separate pages (so that bound
checking is simplified).  Of course, we have no way to know that this
is what is used by the OP...

Hope this helps,
Ilya



------------------------------

Date: Fri, 04 Aug 2006 16:23:30 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: Perl script does nt parses d entire excel file please help
Message-Id: <6wKAg.9616$157.4862@newsread3.news.pas.earthlink.net>

On 08/04/2006 03:42 AM, neo wrote:
> The perl script does not parses d entire excel file.The problem is that 
> it just searches till d 9th record in the excel file.
> 
> the perl script
> [...]
> 

What file? You didn't attach the excel file, so no one can 
test your program with the data you're using. Perhaps you can 
attach a /very small/ excel file that gives you the same 
problem as the normal excel file.



------------------------------

Date: 4 Aug 2006 09:55:34 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Perl script does nt parses d entire excel file please help
Message-Id: <1154710534.287656.97120@p79g2000cwp.googlegroups.com>

Mumia W. wrote:
> On 08/04/2006 03:42 AM, neo wrote:
> > The perl script does not parses d entire excel file.The problem is that
> > it just searches till d 9th record in the excel file.
> >
> > the perl script
> > [...]
> >
>
> What file? You didn't attach the excel file, so no one can
> test your program with the data you're using. Perhaps you can
> attach a /very small/ excel file that gives you the same
> problem as the normal excel file.

No, no he can't.  Attachments don't work in text-only newsgroups.

Paul Lalli



------------------------------

Date: 4 Aug 2006 10:07:54 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: Perl script does nt parses d entire excel file please help
Message-Id: <1154711273.970056.62400@m79g2000cwm.googlegroups.com>

neo wrote:
> The perl script does not parses d entire excel file.The problem is that
> it just searches till d 9th record in the excel file.

"record"??  what's that mean - it never gets to the 10th row? or the
10th worksheet? or the 10th column?

> my $member = $FORM{'hiddenField'};
> my $oExcel = new Spreadsheet::ParseExcel;
> my $oBook = $oExcel->Parse($ExcelFile);
> my $chipcount=0,$drivercount=0;
>
> #print("<div id=\"Layer9\" style=\"position:absolute; left:123px;
> top:197px; width:654px; height:54px; z-index:15; overflow: hidden\">");
> #print("<font size=3>hidden field is $member$member</font><br></div>");
>
> # Read the excel file
> foreach my $oWkS (@{$oBook->{Worksheet}})
>  {
>     defined $oWkS->{MaxRow};

did you happen to notice

  Useless use of defined operator in void context

here?

>     for($i=1;$i<=$oWkS->{MaxRow};$i++)

if it never gets to the 10th row, I'd investigate what value you get
for $oWkS->{MaxRow} and why.  I don't know how MaxRow is determined.

>     {
>         if($oWkS->{Cells}[$i][$membername]->Value eq "")
>         {
>                 next;
>         }
>         $fullname = $oWkS->{Cells}[$i][$membername]->Value;
>         if(index(lc($fullname),$member)!= -1)
>         {
>             #found the member
>             $outname = $fullname;
>             $outest = $oWkS->{Cells}[$i][$est]->Value;
>             $outtst = $oWkS->{Cells}[$i][$tst]->Value;
>             for($j=0;$i<=$oWkS->{MaxRow};$i++)
>             {
>                 print("row $i name $fullname<br>");
>
>                 $outdriver[$drivercount] =
> $oWkS->{Cells}[$i][$driver]->Value;
>                 if($outdriver[$drivercount] ne "")
>                 {
>                     $drivercount++;
>                 }
>                 if($i<$oWkS->{MaxRow})
>                 {
>                     if($oWkS->{Cells}[$i+1][$membername]->Value ne "")
>                     {
>                         last;
>                     }
>                 }
>
>
>             }
>             last;
>         }
>         else
>         {
>             print("row $i name $fullname<br>");
>         }
>     }
> }
> please help me out

instead of pleading, why don't you help us help you.  tell us what your
script is or isn't doing that you want or don't want it to do.  enable
strictures and warnings and modify your code as necessary until it runs
clean.  

-jp



------------------------------

Date: Fri, 04 Aug 2006 10:28:13 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Perl script does nt parses d entire excel file please help
Message-Id: <040820061028138262%jgibson@mail.arc.nasa.gov>

In article <1154680937.928724.253180@p79g2000cwp.googlegroups.com>, neo
<suvratj@gmail.com> wrote:

> The perl script does not parses d entire excel file.The problem is that
> it just searches till d 9th record in the excel file.
> 
> the perl script

Your script looks incomplete. I didn't try compiling or running it.
Next time, please post a complete script that exhibits your problem.

> 
> 
> my $member = $FORM{'hiddenField'};
> my $oExcel = new Spreadsheet::ParseExcel;
> my $oBook = $oExcel->Parse($ExcelFile);

What is in $ExcelFile ?

> my $chipcount=0,$drivercount=0;
> 
> #print("<div id=\"Layer9\" style=\"position:absolute; left:123px;
> top:197px; width:654px; height:54px; z-index:15; overflow: hidden\">");
> #print("<font size=3>hidden field is $member$member</font><br></div>");
> 
> # Read the excel file
> foreach my $oWkS (@{$oBook->{Worksheet}})
>  {
>     defined $oWkS->{MaxRow};

What do you think this line is doing?

>     for($i=1;$i<=$oWkS->{MaxRow};$i++)
>     {
>         if($oWkS->{Cells}[$i][$membername]->Value eq "")

What is in $membername (I am guessing a column number for Member Name).

>         {
>                 next;
>         }
>         $fullname = $oWkS->{Cells}[$i][$membername]->Value;

Looks like you don't have 'use strict;' at the beginning of your
program. Tsk. Tsk.

>         if(index(lc($fullname),$member)!= -1)
>         {
>             #found the member
>             $outname = $fullname;
>             $outest = $oWkS->{Cells}[$i][$est]->Value;
>             $outtst = $oWkS->{Cells}[$i][$tst]->Value;

What are in $est and $tst?

>             for($j=0;$i<=$oWkS->{MaxRow};$i++)
------------------------^ ------------------^

I bet you want $j<=$oWkS->{MaxRow} and $j++ here.

>             {
>                 print("row $i name $fullname<br>");
> 
>                 $outdriver[$drivercount] =
> $oWkS->{Cells}[$i][$driver]->Value;
>                 if($outdriver[$drivercount] ne "")
>                 {
>                     $drivercount++;
>                 }
>                 if($i<$oWkS->{MaxRow})
>                 {
>                     if($oWkS->{Cells}[$i+1][$membername]->Value ne "")
>                     {
>                         last;
>                     }
>                 }
> 
> 
>             }
>             last;
>         }
>         else
>         {
>             print("row $i name $fullname<br>");
>         }
>     }
> }
> 
> 
> 
> 
> please help me out
> 

Please help me out by following the guidelines for this group.


------------------------------

Date: Fri, 04 Aug 2006 10:22:23 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Printing "" and $iIN
Message-Id: <44d36636$0$42188$815e3792@news.qwest.net>

vedpsingh@gmail.com wrote:


> print "Enter value of instantiations ? "; # print out the question
> 

Others have pointed out the solution, I thought I'd mention that $i and 
$j are not very helpful variables.

> my $i;        # \declare" the variable
> my $j;
> $j = <STDIN>; # ask for the username

If $j is what you'd refer to as a username, then use $username, or 
$max_instantiations.. Something which makes the value of the variable, 
more clear.

> for ($i = 0; $i<= $j; $i++) {
If $i is really just a simple counter, then it's fine, however maybe 
something like $row or $instantiation, would be more readable.

> multved_HQrow$iIN := "0000000000000000";


------------------------------

Date: 4 Aug 2006 10:42:52 -0700
From: vedpsingh@gmail.com
Subject: Reading value from File and using in another file
Message-Id: <1154713372.347306.266870@m79g2000cwm.googlegroups.com>

I want to print something looking like this(binary value are in another
text file) :

rec_codein0   000000010000000000 0
rec_codein1   111101110000000000 0
 ......
 .....
rec_codein15  111111110000000000 0
---------------------------------------------------------------------

I have written programmentioned below.
Value is being read in $_ but why can't I print in the desirable way
?
Please point out the mistake.

------------------------------------------------
use strict; # important pragma
use warnings; # another important pragma

open (MYFILERead, 'data.txt');
while (<MYFILERead>) {
chomp;
print "$_\n";
}

print "Enter value of instantiations ? "; # print out the question
chomp( my $j = <STDIN> );

for (my $i = 0; $i < $j; $i++)  {

my $file = 'copypaste.txt';
open my $MYFILE, '>>', $file or die "Could not open '$file': $!\n";

print MYFILE "
           rec_codein$i  $_\n ";
}
close (MYFILE);
close (MYFILERead);
----------------------------------------------------------

File "data.txt" contains ------>

111110110000000000
111101110000000000
000000010000000000
000001100000000000
111110000000000000
000000010000000000
000010000000000000
000000100000000000
000000110000000000
111110000000000000
000000110000000000
000000000000000000
000001100000000000
111110100000000000
000000110000000000
111111110000000000

Thanks



------------------------------

Date: 4 Aug 2006 11:01:22 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Reading value from File and using in another file
Message-Id: <1154714482.784475.307320@h48g2000cwc.googlegroups.com>

vedpsingh@gmail.com wrote:
> Value is being read in $_ but why can't I print in the desirable way
> ?
> Please point out the mistake.
>
> ------------------------------------------------
> use strict; # important pragma
> use warnings; # another important pragma
>
> open (MYFILERead, 'data.txt');

I don't understand why you made the three standard mistakes in this
open when you did it correctly later on.  Don't use global barewords,
use the three-argument form, and check for errors!

> while (<MYFILERead>) {

Here, you read a line from the file into $_

> chomp;
> print "$_\n";
> }

Here, at the end of each iteration, that value of $_ is thrown away.
You never saved it anywhere.

>
> print "Enter value of instantiations ? "; # print out the question
> chomp( my $j = <STDIN> );
>
> for (my $i = 0; $i < $j; $i++)  {
>
> my $file = 'copypaste.txt';
> open my $MYFILE, '>>', $file or die "Could not open '$file': $!\n";

Here, you're re-opening the file every time through the loop. Why?
Open it once.

>
> print MYFILE "
>            rec_codein$i  $_\n ";

Here, you're trying to print the value of $_.  $_ does not contain
anything.  It contained something only during each iteration of the
first while loop.  After that while loop, that data was discarded.

> }
> close (MYFILE);
> close (MYFILERead);

You need to re-order your programs into a logical sense.
Unfortunately, I have no idea what $i or $j have to do with the data
read from your data file, so I can't help you reorganize it.

Paul Lalli



------------------------------

Date: Fri, 04 Aug 2006 18:02:37 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Reading value from File and using in another file
Message-Id: <Xns98158EF45BA24asu1cornelledu@127.0.0.1>

vedpsingh@gmail.com wrote in news:1154713372.347306.266870
@m79g2000cwm.googlegroups.com:

> I want to print something looking like this(binary value are 
> in another text file) :
> 
> rec_codein0   000000010000000000 0
> rec_codein1   111101110000000000 0
> ......
> .....
> rec_codein15  111111110000000000 0
> ---------------------------------------------------------------------
> 
> I have written programmentioned below.
> Value is being read in $_ but why can't I print in the desirable way
> ?

What do you get instead?

> ------------------------------------------------
> use strict; # important pragma
> use warnings; # another important pragma

Asinine comments are worse than no comments.

> open (MYFILERead, 'data.txt');

* Checking whether open succeded is not optional. You must do it.
* Lexical filehandles are recommended.
* 3-argument open is preferable in most instances (although it does not 
make a difference in case the filename is hardcoded).

my ($data_file) = @ARGV;

open $read_handle, '<', $data_file
  or die "Cannot open '$data_file': $!";

> while (<MYFILERead>) {
> chomp;
> print "$_\n";
> }

Do you realize you are throwing away the data?!!!

> print MYFILE "
>            rec_codein$i  $_\n ";

Why the additional newline before each record?

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 9561
***************************************


home help back first fref pref prev next nref lref last post