>>>>> "M" == Maggs  <maggiechimbwa...@googlemail.com> writes:

  M> sub read_file{
  M>     local ($filevar) = @_;

don't use local for that (or for much else). use my. local is meant now
only for special cases with dynamic scoping.

  M>     <$filevar>;
  M> }

why do you need a whole sub to read a line? just <$filevar> does the
same thing!

  M> sub read_file{
  M>    local($filevar, $line) = @_;
  M>    print $filevar ($line);
  M> }

and you have two subs with the same name doing different things. very
confusing and of course only one will be found by perl. the second one
should be called write_file. in neither case do you show the open
calls.

given what you are calling them, use File::Slurp which has read_file and
write_file subs which do all the work you seem to want here. much
cleaner than your code.

uri

-- 
Uri Guttman  --  uri AT perlhunter DOT com  ---  http://www.perlhunter.com --
------------  Perl Developer Recruiting and Placement Services  -------------
-----  Perl Code Review, Architecture, Development, Training, Support -------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to