>>>>> "SF" == Shlomi Fish <shlo...@iglu.org.il> writes:

  SF> Hi Uri,
  SF> thanks for all your input on this list. See below for my response.

  SF> On Monday 18 Apr 2011 07:56:16 Uri Guttman wrote:
  >> >>>>> "mr" == marcos rebelo <ole...@gmail.com> writes:
  mr> Ugly but may work, with a simple eval
  mr> use strict;
  mr> use warnings;
  >> 
  mr> my $var = '$str. q( abc_xyz)';
  mr> my $str;
  >> 
  mr> for(my $i=1;$i <= 5; $i++){
  mr> $str = $i;
  mr> my $line = 'Line: '.eval $var;
  mr> print "$line\n";
  mr> }
  >> 
  >> NEVER do that for such a simple problem. eval string is a last resort
  >> when no other technique can work well.

  SF> Well, you are right naturally, but there is no need to be so
  SF> rude. Start your email with a greeting, continue with a
  SF> compliment, use soft words, etc.  Otherwise, you may be scaring
  SF> many people away. See some of my advice in:

it isn't rude. this comes up often enough that it needs to be snipped in
the bud. eval string is not for newbies or even experienced coders
unless it is ABSOLUTELTY needed. it has too many dangers to ignore that rule.

this is akin to a toddler reaching out to touch the stove. you have to
stop it before it happens. when some on this list post eval solutions,
that has to be stopped before some newbie runs with the answer. the code
that results will be dangerous to an extreme. yelling to prevent a stove
burn is not only acceptable, but commendable. i won't back off what i
said.

NEVER USE STRING EVAL unless you absolutely must and you know what you
are doing. it should NEVER be the first answer to ANYTHING.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
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