>>>>> "ta" == timothy adigun <2teezp...@gmail.com> writes:

  ta> I believe you know that in Perl there are more than one way to do
  ta> it! i.e solve a problem. And that one way is no better than the
  ta> other, it only depend on what the programmer preferred to use, as
  ta> long as the syntax are correct.  Secondly, most of your why would
  ta> have been answered, if only you check Ryan Lagola's request.

  >>> If @ARGV contains more than one element then this will not work correctly.

  ta>  *Not true!* using $ARGV[0], select only one file to generate your
  ta> report from. But using @ARGV, one has all the files
  ta> listed. Moreover, how do you know how many files he/she intended
  ta> using from the CLI at once?! So, for me it is saver to use
  ta> @ARGV. Please, don't misunderstand this, there are several ways of
  ta> doing things!

no, you had this code:

        chomp(my $raw_file=<@ARGV>);

and that will not work if @ARGV has more than one filename. try it out
and see.

  >> open READFILE,"<","$raw_file" or die "can't open $!";

  >>> Why are you copying $raw_file to a string?

  ta>   open OUTPUTFILE,">","$filename" or die "cannot read $!";
  >> 

  >>> Why are you copying $filename to a string?

  ta> I don't know what you mean by "copying both $raw_file and $filename into a
  ta> string"! If you mean by using a double quote around $raw_file and 
$filename,
  ta> then I should explain that that is called Interpolation in Perl! -- These
  ta> two variables are scalar, so when a double quote they are interpolated i.e
  ta> the value of the scalar (in this context) is inserted.

you are telling someone who knows perl well about interpolation. but
what you didn't get (and john didn't explain clearly enough it seems),
is that quoting a scalar like that isn't needed and it makes an extra
useless copy of the data. you can pass a scalar anywhere you want
without quoting it. also in some cases like with objects, quoting it
will actually be a bug.

  ta> Lastly, codes are written to be improved on. One of the reasons we have
  ta> different books!

huh?? this has nothing to do with books. it is just poor coding and john
was correcting you.

also please learn to edit quoted posts as there is no reason to see all
of the previous emails.

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