Dynamic replacement of the variable

--20cf3054a4610059f704a121277b
Content-Type: text/plain; charset=UTF-8

Hi,

I am not sure if this can be done. But just asking it out of curiosity. I
have written this snippet.

use strict;
use warnings;

my $var = '$str abc_xyz';
my $str;

for(my $i=1;$i <= 5; $i++){
$str = $i;
my $line = 'Line: '.$var;
print "$line\n";
}

Currently it displays:

Line: $str abc_xyz
Line: $str abc_xyz
Line: $str abc_xyz
Line: $str abc_xyz
Line: $str abc_xyz

But can I make it output following:

Line: 1 abc_xyz
Line: 2 abc_xyz
Line: 3 abc_xyz
Line: 4 abc_xyz
Line: 5 abc_xyz

i.e. I want $str to be dynamically replaced with the value of number.

~Parag

--20cf3054a4610059f704a121277b--
Parag Kalra [ So, 17 April 2011 20:07 ] [ ID #2058274 ]

Re: Dynamic replacement of the variable

Hi Parag,

On Sunday 17 Apr 2011 21:07:27 Parag Kalra wrote:
> Hi,
>
> I am not sure if this can be done. But just asking it out of curiosity. I
> have written this snippet.
>
> use strict;
> use warnings;
>
> my $var = '$str abc_xyz';
> my $str;
>
> for(my $i=1;$i <= 5; $i++){
> $str = $i;
> my $line = 'Line: '.$var;
> print "$line\n";
> }
>

The proper way to do it is to use a templating engine. See:

http://perl-begin.org/uses/text-generation/

http://perldoc.perl.org/functions/sprintf.html should be enough here.

Regards,

Shlomi Fish

--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
"The Human Hacking Field Guide" - http://shlom.in/hhfg

Judaism: God is all the shit, all the non-shit and all the intermediate
demi-shits in between.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Shlomi Fish [ So, 17 April 2011 20:23 ] [ ID #2058275 ]

Re: Dynamic replacement of the variable

On 17/04/2011 19:07, Parag Kalra wrote:
> Hi,
>
> I am not sure if this can be done. But just asking it out of curiosity. I
> have written this snippet.
>
> use strict;
> use warnings;
>
> my $var = '$str abc_xyz';
> my $str;
>
> for(my $i=1;$i<= 5; $i++){
> $str = $i;
> my $line = 'Line: '.$var;
> print "$line\n";
> }
>
> Currently it displays:
>
> Line: $str abc_xyz
> Line: $str abc_xyz
> Line: $str abc_xyz
> Line: $str abc_xyz
> Line: $str abc_xyz
>
> But can I make it output following:
>
> Line: 1 abc_xyz
> Line: 2 abc_xyz
> Line: 3 abc_xyz
> Line: 4 abc_xyz
> Line: 5 abc_xyz
>
> i.e. I want $str to be dynamically replaced with the value of number.

You could use a subroutine instead of a variable, as below.

Your variable names need to be more descriptive. I can't tell what their
purpose is so have used your names, but please fix them before you use
this code.

HTH,

Rob


use strict;
use warnings;

my $str;

sub var { "$str abc_xyz" }

for my $i (1 .. 5) {
$str = $i;
my $line = 'Line: ' . var;
print "$line\n";
}

**OUTPUT**

Line: 1 abc_xyz
Line: 2 abc_xyz
Line: 3 abc_xyz
Line: 4 abc_xyz
Line: 5 abc_xyz

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Rob Dixon [ So, 17 April 2011 23:30 ] [ ID #2058276 ]

Re: Dynamic replacement of the variable

>>>>> "RD" == Rob Dixon <rob.dixon [at] gmx.com> writes:

RD> use strict;
RD> use warnings;

RD> my $str;

RD> sub var { "$str abc_xyz" }

RD> for my $i (1 .. 5) {
RD> $str = $i;
RD> my $line = 'Line: ' . var;
RD> print "$line\n";
RD> }

using a global to get around symrefs is not a win. a template or sprintf
are much better solutions. even a one liner with a hash and s/// is
simple and effective for this (it is the simplest templater around).

uri

--
Uri Guttman ------ uri [at] 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-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Uri Guttman [ So, 17 April 2011 23:35 ] [ ID #2058277 ]

Re: Dynamic replacement of the variable

Ugly but may work, with a simple eval

use strict;
use warnings;

my $var =3D '$str. q( abc_xyz)';
my $str;

for(my $i=3D1;$i <=3D 5; $i++){
$str =3D $i;
my $line =3D 'Line: '.eval $var;
print "$line\n";
}

Best Regards
Marcos

On Sun, Apr 17, 2011 at 20:23, Shlomi Fish <shlomif [at] iglu.org.il> wrote:
> Hi Parag,
>
> On Sunday 17 Apr 2011 21:07:27 Parag Kalra wrote:
>> Hi,
>>
>> I am not sure if this can be done. But just asking it out of curiosity. =
I
>> have written this snippet.
>>
>> use strict;
>> use warnings;
>>
>> my $var =3D '$str abc_xyz';
>> my $str;
>>
>> for(my $i=3D1;$i <=3D 5; $i++){
>> =A0 =A0 $str =3D $i;
>> =A0 =A0 my $line =3D 'Line: '.$var;
>> =A0 =A0 print "$line\n";
>> }
>>
>
> The proper way to do it is to use a templating engine. See:
>
> http://perl-begin.org/uses/text-generation/
>
> http://perldoc.perl.org/functions/sprintf.html should be enough here.
>
> Regards,
>
> =A0 =A0 =A0 =A0Shlomi Fish
>
> --
> ------------------------------------------------------------ -----
> Shlomi Fish =A0 =A0 =A0 http://www.shlomifish.org/
> "The Human Hacking Field Guide" - http://shlom.in/hhfg
>
> Judaism: God is all the shit, all the non-shit and all the intermediate
> demi-shits in between.
>
> Please reply to list if it's a mailing list post - http://shlom.in/reply =
..
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
> For additional commands, e-mail: beginners-help [at] perl.org
> http://learn.perl.org/
>
>
>



--
Marcos Rebelo
http://www.oleber.com/
Milan Perl Mongers leader https://sites.google.com/site/milanperlmongers/
Webmaster of http://perl5notebook.oleber.com

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
oleber [ Mo, 18 April 2011 06:42 ] [ ID #2058327 ]

Re: Dynamic replacement of the variable

>>>>> "mr" == marcos rebelo <oleber [at] 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.

and please learn to edit quoted email. there is no reason to see the
whole original email. also read a full thread before answering is a good
thing. this query was answered well several times already.

uri

--
Uri Guttman ------ uri [at] 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-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Uri Guttman [ Mo, 18 April 2011 06:56 ] [ ID #2058328 ]

Re: Dynamic replacement of the variable

Hi Uri,

thanks for all your input on this list. See below for my response.

On Monday 18 Apr 2011 07:56:16 Uri Guttman wrote:
> >>>>> "mr" == marcos rebelo <oleber [at] 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.

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

http://unarmed.shlomifish.org/909.html

>
> and please learn to edit quoted email. there is no reason to see the
> whole original email. also read a full thread before answering is a good
> thing. this query was answered well several times already.
>

Again, you can say it in a much more friendly and pleasant manner.

Regards,

Shlomi Fish

--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Why I Love Perl - http://shlom.in/joy-of-perl

"My name is Inigo Montoya. You forced my father to write XSLT. Prepare to die!
And be thankful I don't force you to write XSLT."

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Shlomi Fish [ Mo, 18 April 2011 07:45 ] [ ID #2058329 ]

Re: Dynamic replacement of the variable

>>>>> "SF" == Shlomi Fish <shlomif [at] 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 <oleber [at] 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 ------ uri [at] 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-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Uri Guttman [ Mo, 18 April 2011 07:50 ] [ ID #2058330 ]

Re: Dynamic replacement of the variable

--00248c0eec4cab99ad04a12f71c1
Content-Type: text/plain; charset=ISO-8859-1

On Apr 18, 2011 1:51 AM, "Uri Guttman" <uri [at] stemsystems.com> wrote:
>
> >>>>> "SF" == Shlomi Fish <shlomif [at] iglu.org.il> writes:
>
> >> 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.
>

I didn't find that part rude, I found the part about 'if you'd read the
whole thread you'd see the question was answered' a bit rude, bitchy, and
unnecessary. Actually, it was worse than that if it gave people the sense
that after a certain point in a discussion their contribution is unwanted.

--00248c0eec4cab99ad04a12f71c1--
Shawn Wilson [ Mo, 18 April 2011 13:10 ] [ ID #2058334 ]

Re: Dynamic replacement of the variable

Hi Uri,

On Monday 18 Apr 2011 08:50:43 Uri Guttman wrote:
> >>>>> "SF" == Shlomi Fish <shlomif [at] 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 <oleber [at] 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.

I agree that it is bad and has to be sniped in the bud. But they way you're
expressing yourself on E-mails is alienating many people.

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

Well, what are the implications of someone using eval in production code
(which would be perfectly safe in this example, although sub-ideal) vs. a
toddler reaching out to touch the stove? You're overstating the consequences.

You could have said that it is not a good thing, while being polite and much
less hostile and angry. As it is, you are scaring many people from this list.

I was not referring just to tthis particular E-mail of yours, but to your
general trend of hostile communication. You should try to be more friendly and
pleasant.

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

You are right about that, but that wasn't my point.

Regards,

Shlomi Fish

--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Understand what Open Source is - http://shlom.in/oss-fs

Stray XSLT code causes more deaths than road accidents.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Shlomi Fish [ Mo, 18 April 2011 14:07 ] [ ID #2058335 ]

Re: Dynamic replacement of the variable

On Apr 18, 2011, at 7:07 AM, Shlomi Fish wrote:

> You could have said that it is not a good thing, while being polite =
and much
> less hostile and angry. As it is, you are scaring many people from =
this list.

You're right.

I find it staggering that, on a list contributed to by so many =
intelligent, or at least technically proficient, individuals, there are =
these periodic outbursts of venom. I'm relieved to hear that there are =
others who are sensitive (yes, sensitive) to, and who object to, this =
behavior.

I won't pretend to speak for anyone other than myself: I think Perl is a =
joy. I love it, and it has been immensely helpful. I appreciate that =
there are people who are willing to provide free assistance via this =
list (and others). But on the occasions I've had to post a question, I =
admit I've approached with a certain amount of apprehensiveness, if not =
dread. Oh, I cross my t's and dot my i's, use my stricts, trim my =
quotes, bottom my posts and so forth; you betcha. And actually, I've =
never been publicly reamed by anyone on this list. I've cringed and =
shouted "IDIOT!" at my screen when newbie posters fail to articulate, or =
analyze, or lift a finger to help themselves, but that's largely because =
I just *know* there's going to be another outburst of ugliness, =
sanctimoniously justified as intended to nip THEIR bad netiquette in the =
bud.

I've tutored a few individuals in beginning programming, although not in =
Perl yet (or should it be perl? yikes). But I'd be very wary of =
advising newbies to use this list for their questions, without letting =
them know that, despite its self-description as "a list for beginning =
Perl programmers to ask questions in a friendly atmosphere," the word =
"friendly" is not universally observed.

The FAQ states that Casey West, Kevin Meltzer and Ask Bjoern Hansen are =
maintainers of peace and order on the list. It would be interesting to =
hear if they think there's any truth, or concern, about scaring people =
away.

If the answer is "tough - deal with it," that's okay. I don't claim any =
right to have it my way. I'm only one person, and the only thing it =
affects is my loyalty. I'll continue to use Perl, and to use the list =
until something better comes along. I just wish that I still wanted to =
brag about it.

Sincerely,
Chap Harrison



--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Chap Harrison [ Mo, 18 April 2011 19:55 ] [ ID #2058339 ]

Re: Dynamic replacement of the variable

Hi Chap,

thanks for supporting me.

Regards,

Shlomi Fish

On Monday 18 Apr 2011 20:55:49 Chap Harrison wrote:
> On Apr 18, 2011, at 7:07 AM, Shlomi Fish wrote:
> > You could have said that it is not a good thing, while being polite and
> > much less hostile and angry. As it is, you are scaring many people from
> > this list.
>
> You're right.
>
> I find it staggering that, on a list contributed to by so many intelligent,
> or at least technically proficient, individuals, there are these periodic
> outbursts of venom. I'm relieved to hear that there are others who are
> sensitive (yes, sensitive) to, and who object to, this behavior.
[SNIP]

--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
"Humanity" - Parody of Modern Life - http://shlom.in/humanity

Stray XSLT code causes more deaths than road accidents.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Shlomi Fish [ Mo, 18 April 2011 23:39 ] [ ID #2058340 ]

Re: Dynamic replacement of the variable

From: Shlomi Fish <shlomif [at] iglu.org.il>
> On Monday 18 Apr 2011 08:50:43 Uri Guttman wrote:
> > >>>>> "SF" == Shlomi Fish <shlomif [at] 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 <oleber [at] 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:

Try Alcoholics Anonymous. This is not a post-traumatic mutual support
group, this is a technical mailing list! If you can't handle a terse
and to the point reply, you should change the profession and try to
find nicer talking people in the humanities. The catch is that the
emails will start with a greeting, continue with a compliment, use
soft words ... and be empty, empty, empty.

> You could have said that it is not a good thing, while being polite and much
> less hostile and angry. As it is, you are scaring many people from this list.

As it is, those people should not be doing anything technical in the
first place. The compiler will not start with a greeting and
compliment their hairstyle either.

Jenda
===== Jenda [at] Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Jenda Krynicky [ Di, 19 April 2011 13:56 ] [ ID #2058377 ]

Re: Dynamic replacement of the variable

On 19/04/2011 12:56, Jenda Krynicky wrote:
>>>
>>> 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:
>
> Try Alcoholics Anonymous. This is not a post-traumatic mutual support
> group, this is a technical mailing list! If you can't handle a terse
> and to the point reply, you should change the profession and try to
> find nicer talking people in the humanities. The catch is that the
> emails will start with a greeting, continue with a compliment, use
> soft words ... and be empty, empty, empty.
>
>> You could have said that it is not a good thing, while being polite and much
>> less hostile and angry. As it is, you are scaring many people from this list.
>
> As it is, those people should not be doing anything technical in the
> first place. The compiler will not start with a greeting and
> compliment their hairstyle either.

You really believe that conveying technical knowledge requires rudeness,
sarcasm, and snide remarks? Too many people here seem to think that the
extent of their Perl knowledge entitles them to fits of bad manners and
lazy language. If you struggle to make positive comments as well as
negative ones then perhaps you should stick to writing Perl instead of
trying to teach it.

Nobody likes the pompous selfish drivers on the road that have more
money than wit, and insist on driving their expensive cars badly and
dangerously. They impress no one, and nor do those that are wealthy in
knowledge but challenged in wisdom and common sense that like to post
ridicule and abuse on this list. For goodness sake stop it and try to
write well instead.

Rob

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Rob Dixon [ Di, 19 April 2011 15:22 ] [ ID #2058378 ]

Re: Dynamic replacement of the variable

On Tue, Apr 19, 2011 at 9:22 AM, Rob Dixon <rob.dixon [at] gmx.com> wrote:
> On 19/04/2011 12:56, Jenda Krynicky wrote:
>>>>
>>>> =A0 SF> =A0Well, you are right naturally, but there is no need to be s=
o
>>>> =A0 SF> =A0rude. Start your email with a greeting, continue with a
>>>> =A0 SF> =A0compliment, use soft words, etc. =A0Otherwise, you may be s=
caring
>>>> =A0 SF> =A0many people away. See some of my advice in:
>>
>> Try Alcoholics Anonymous. This is not a post-traumatic mutual support
>> group, this is a technical mailing list! If you can't handle a terse
>> and to the point reply, you should change the profession and try to
>> find nicer talking people in the humanities. The catch is that the
>> emails will start with a greeting, continue with a compliment, use
>> soft words ... and be empty, empty, empty.
>>
>>> You could have said that it is not a good thing, while being polite and
>>> much
>>> less hostile and angry. As it is, you are scaring many people from this
>>> list.
>>
>> As it is, those people should not be doing anything technical in the
>> first place. The compiler will not start with a greeting and
>> compliment their hairstyle either.
>
> You really believe that conveying technical knowledge requires rudeness,
> sarcasm, and snide remarks? Too many people here seem to think that the
> extent of their Perl knowledge entitles them to fits of bad manners and
> lazy language. If you struggle to make positive comments as well as
> negative ones then perhaps you should stick to writing Perl instead of
> trying to teach it.
>

well, it is our culture. some fields have a culture of inclusion,
technology generally has a culture of exclusion. Uri and Jenda's
remarks show pretty good examples if this elite attitude. not saying
that it's right or that cultures can't change, just saying what i've
experienced (and sometimes dealt out). than again, maybe that's why we
get paid so well; not really because of being able to do things that
no one else can do but because we deal with and serve up bull shit so
well - that might be our biggest honed skill.

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Shawn Wilson [ Di, 19 April 2011 16:27 ] [ ID #2058379 ]

Re: Dynamic replacement of the variable

Hello friends in the list,

I did not want to reply, however, I have now been forced to reply.

On 04/19/2011 05:26 PM, Jenda Krynicky wrote:
> Try Alcoholics Anonymous. This is not a post-traumatic mutual support
> group, this is a technical mailing list! If you can't handle a terse
> and to the point reply, you should change the profession and try to
> find nicer talking people in the humanities. The catch is that the
> emails will start with a greeting, continue with a compliment, use
> soft words ... and be empty, empty, empty.

A 'Technical mailing-list' does not mean that the posts are posted/read
by bots! Posts are posted/read by humans who have feelings and can get
hurt. Statements like the ones quoted above do more harm than good.

On 04/19/2011 05:26 PM, Jenda Krynicky wrote:
> As it is, those people should not be doing anything technical in the
> first place. The compiler will not start with a greeting and
> compliment their hairstyle either.

No one is born a programmer; nor does anyone become a perfectionist
overnight. Perl might even be some people's first attempt at learning a
programming language. Quoting Learning Perl: "=E2=80=A6 we're pleased tha=
t we've
had many reports of people successfully picking up [Learning Perl] and
grasping Perl as their first programming language =E2=80=A6". This list i=
s
focused on such people. Beginners! We should encourage them and grow the
community rather than be rude and let them search for 'green pastures'.

For a language to survive, there has to be a thriving community of
users. A mailing-list that welcomes new users and assists them is what I
call a 'healthy mailing-list'. Such lists will increase user
participation and eventually lead to the list being 'useful' to the
posters as well as to the community.

Flaming is __HARM__ done to the community. No one enjoys it. It is the
best way to be destructive!

One of my personal experiences:
I once posted an answer here (which happened to be wrong) and I had
included a sentence: "Hope it is clear now." at the bottom of my
message. However, a public reply that I got included (other than some
useful corrections), a reply to the above sentence: "No, nothing is
clear from those answers." which was an avoidable, unnecessary quote. If
the replier had appended a smiley :-) to the sentence, I would have
certainly considered it humorous. If you are into pun, or play with
words, consider using smileys as this list is followed by people from
different nations, backgrounds, cultures and native languages. Most (if
not all) are able to understand smileys. Not everyone's first language
is English. It is better not to be ambiguous.

In my humble opinion, for rules like quoting e-mails, using/not using
line numbers, indenting, et cetera, a wiki page should be created which
could then be pointed to when needed. If anyone is interested, please
let me know so that we can build one.

As an aside: I am sorry if any uneasiness was caused by my statements.
This was inevitable.

A proverb for the thoughtful: "Prevention is better than cure".

Regards,
Alan Haggai Alavi.
--
The difference makes the difference

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Alan Haggai Alavi [ Di, 19 April 2011 16:40 ] [ ID #2058380 ]

Re: Dynamic replacement of the variable

On 19/04/2011 15:27, shawn wilson wrote:
> On Tue, Apr 19, 2011 at 9:22 AM, Rob Dixon<rob.dixon [at] gmx.com> wrote:
>> On 19/04/2011 12:56, Jenda Krynicky wrote:
>>>
>>> Try Alcoholics Anonymous. This is not a post-traumatic mutual support
>>> group, this is a technical mailing list! If you can't handle a terse
>>> and to the point reply, you should change the profession and try to
>>> find nicer talking people in the humanities. The catch is that the
>>> emails will start with a greeting, continue with a compliment, use
>>> soft words ... and be empty, empty, empty.
>>>
>>>> You could have said that it is not a good thing, while being
>>>> polite and much less hostile and angry. As it is, you are
>>>> scaring many people from this list.
>>>
>>> As it is, those people should not be doing anything technical in the
>>> first place. The compiler will not start with a greeting and
>>> compliment their hairstyle either.
>>
>> You really believe that conveying technical knowledge requires rudeness,
>> sarcasm, and snide remarks? Too many people here seem to think that the
>> extent of their Perl knowledge entitles them to fits of bad manners and
>> lazy language. If you struggle to make positive comments as well as
>> negative ones then perhaps you should stick to writing Perl instead of
>> trying to teach it.
>
> well, it is our culture. some fields have a culture of inclusion,
> technology generally has a culture of exclusion. Uri and Jenda's
> remarks show pretty good examples if this elite attitude. not saying
> that it's right or that cultures can't change, just saying what i've
> experienced (and sometimes dealt out).

I'm afraid you're right Shawn. Randal also is famous for his nastiness
(although he seems to have calmed down a lot in his latter posts) and it
seems that those who can best afford to be magnanimous have the meanest
of spirits. I have written acerbic pieces myself, but it has always been
at times when I was unwell, worried or upset. I always regretted it
afterwards. Offensive language is a forgiveable mistake, and worse than
bad spelling or grammar. But when I see it defended as inevitable or
even beneficial I begin to wonder how people can get so lost.

Offering someone advice with a side helping of a slap in the face always
degrades the experience of all parties. It may be excuseable, but never
more than that.

> than again, maybe that's why we get paid so well; not really because
> of being able to do things that no one else can do but because we
> deal with and serve up bull shit so well - that might be our biggest
> honed skill.

Now you're getting cynical. Companies have salesmen to abuse people if
need be - no need for us engineers to get involved!

Rob


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Rob Dixon [ Di, 19 April 2011 18:06 ] [ ID #2058383 ]

Re: Dynamic replacement of the variable

From: Rob Dixon <rob.dixon [at] gmx.com>
> On 19/04/2011 12:56, Jenda Krynicky wrote:
> >>>
> >>> 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:
> >
> > Try Alcoholics Anonymous. This is not a post-traumatic mutual support
> > group, this is a technical mailing list! If you can't handle a terse
> > and to the point reply, you should change the profession and try to
> > find nicer talking people in the humanities. The catch is that the
> > emails will start with a greeting, continue with a compliment, use
> > soft words ... and be empty, empty, empty.
> >
> >> You could have said that it is not a good thing, while being polite and much
> >> less hostile and angry. As it is, you are scaring many people from this list.
> >
> > As it is, those people should not be doing anything technical in the
> > first place. The compiler will not start with a greeting and
> > compliment their hairstyle either.
>
> You really believe that conveying technical knowledge requires rudeness,
> sarcasm, and snide remarks?

No. But it doesn't require off topic compliments either. Programmers,
especially the more experienced ones, tend to be busy folk. Both
those that ask and those that reply.

There was no rudeness in the original reply that caused all this
weeping, much less sarcasm or snide remarks. It was a terse, to the
point reply. Exactly what you should expect and get at a technical
forum.

> Too many people here seem to think that the
> extent of their Perl knowledge entitles them to fits of bad manners and
> lazy language. If you struggle to make positive comments as well as
> negative ones then perhaps you should stick to writing Perl instead of
> trying to teach it.

If there's nothing to positively comment on, I an't gonna make up
something just so that someone would feel better. That's not what
this list is for. If you need someone to pet your ego, find some
other place for that. This is a place for technical questions!

> Nobody likes the pompous selfish drivers on the road that have more
> money than wit, and insist on driving their expensive cars badly and
> dangerously. They impress no one, and nor do those that are wealthy in
> knowledge but challenged in wisdom and common sense that like to post
> ridicule and abuse on this list. For goodness sake stop it and try to
> write well instead.

I'd rather write the truth, than something that feels nice.


From shawn wilson <ag4ve.us [at] gmail.com>:
> well, it is our culture. some fields have a culture of inclusion,
> technology generally has a culture of exclusion.

B U L L S H I T

Technology generally has a culture of honesty. If you do something stupid,
you are told you are doing something stupid.
Without undue care about your ego, working under the asumption that
you are a mature person.

Yes, there are other fields where people treat you nice and kind ...
letting you shot yourself in the foot rather than appering rude by
telling you something you might not like to hear.


From Alan Haggai Alavi <alanhaggai [at] alanhaggai.org>:

> A mailing-list that welcomes new users and assists them is what I call
> a 'healthy mailing-list'. Such lists will increase user
> participation and eventually lead to the list being 'useful' to the
> posters as well as to the community.

I see. So you think a greeting and made up compliments are
assistance?

> Flaming is __HARM__ done to the community. No one enjoys it. It is the
> best way to be destructive!

Which is exactly why we should cut off this silly thread.
Especially since the very first to flame in this thread was Shlomi
Fish!

Let me quote again Uri's response:

> NEVER do that for such a simple problem. eval string is a last resort
> when no other technique can work well.

> and please learn to edit quoted email. there is no reason to see the
> whole original email. also read a full thread before answering is a
> good thing. this query was answered well several times already.

Now that was incredibly rude. How could any human being write
anything so insanely rude to another human being? Oh my gosh I'm
gonna cryyyyyy!!!!

Jenda
===== Jenda [at] Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Jenda Krynicky [ Di, 19 April 2011 19:20 ] [ ID #2058385 ]

Re: Dynamic replacement of the variable

>>>>> "JK" == Jenda Krynicky <Jenda [at] Krynicky.cz> writes:

JK> Let me quote again Uri's response:

>> NEVER do that for such a simple problem. eval string is a last resort
>> when no other technique can work well.

i used one upper case word for emphasis, not rudeness. if you call that
rude, you are way too sensitive to be in computing.

note that i review code and give feedback for my profession as a perl
recruiter. one aspect i look for in candidates is how well they take and
learn from my feedback. the real world will smack you down way more than
ever happens here. consider this a mild lesson on how to cope with
technical feedback in ways you don't want.

>> and please learn to edit quoted email. there is no reason to see the
>> whole original email. also read a full thread before answering is a
>> good thing. this query was answered well several times already.

and i said please there. and just some regular comments on posting style
we have all seen and said before. nothing rude anywhere.

JK> Now that was incredibly rude. How could any human being write
JK> anything so insanely rude to another human being? Oh my gosh I'm
JK> gonna cryyyyyy!!!!

pood jenda! :)

and i will still reply with strong (but not rude) words about very bad
code here. newbies need to learn to not touch the stove before they get
burned. nothing is worse than a newbie who learns symrefs and string
eval and starts to use them for everything. i have seen that before and
it needs to be nipped in the bud each time.

over and out on this.

uri

--
Uri Guttman ------ uri [at] 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-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Uri Guttman [ Di, 19 April 2011 19:30 ] [ ID #2058386 ]

Re: Dynamic replacement of the variable

>
> and i will still reply with strong (but not rude) words about very bad
> code here. newbies need to learn to not touch the stove before they get
> burned. nothing is worse than a newbie who learns symrefs and string
> eval and starts to use them for everything. i have seen that before and
> it needs to be nipped in the bud each time.
>

ah, i finally got something out of this - an idea for an acme module
that uses string eval, symrefs and any other bad idea i can think of.
i'll have to find a way to quote this email thread in an error message
too :)

.... unless it's already been done?

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Shawn Wilson [ Di, 19 April 2011 21:08 ] [ ID #2058387 ]

Re: Dynamic replacement of the variable

On Tuesday 19 Apr 2011 20:20:27 Jenda Krynicky wrote:
> From: Rob Dixon <rob.dixon [at] gmx.com>
>
> > On 19/04/2011 12:56, Jenda Krynicky wrote:
> > >>> 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:
> > > Try Alcoholics Anonymous. This is not a post-traumatic mutual support
> > > group, this is a technical mailing list! If you can't handle a terse
> > > and to the point reply, you should change the profession and try to
> > > find nicer talking people in the humanities. The catch is that the
> > > emails will start with a greeting, continue with a compliment, use
> > > soft words ... and be empty, empty, empty.
> > >
> > >> You could have said that it is not a good thing, while being polite
> > >> and much less hostile and angry. As it is, you are scaring many
> > >> people from this list.
> > >
> > > As it is, those people should not be doing anything technical in the
> > > first place. The compiler will not start with a greeting and
> > > compliment their hairstyle either.
> >
> > You really believe that conveying technical knowledge requires rudeness,
> > sarcasm, and snide remarks?
>
> No. But it doesn't require off topic compliments either. Programmers,
> especially the more experienced ones, tend to be busy folk. Both
> those that ask and those that reply.
>
> There was no rudeness in the original reply that caused all this
> weeping, much less sarcasm or snide remarks. It was a terse, to the
> point reply. Exactly what you should expect and get at a technical
> forum.

Often, a terse and to the point reply can be rude and tactless. Replies sho=
uld
be written in a friendly tone while not insulting the other party or
catastrophising them.

>
> > Too many people here seem to think that the
> > extent of their Perl knowledge entitles them to fits of bad manners and
> > lazy language. If you struggle to make positive comments as well as
> > negative ones then perhaps you should stick to writing Perl instead of
> > trying to teach it.
>
> If there's nothing to positively comment on, I an't gonna make up
> something just so that someone would feel better. That's not what
> this list is for. If you need someone to pet your ego, find some
> other place for that. This is a place for technical questions!
>

It is, but people are humans, and they like to be treated in a friendly
manner. What Uri is consistently doing is replying rudely and tersely and
scaring away many people who are trying to get help and those who witness w=
hat
he is saying.

> > Nobody likes the pompous selfish drivers on the road that have more
> > money than wit, and insist on driving their expensive cars badly and
> > dangerously. They impress no one, and nor do those that are wealthy in
> > knowledge but challenged in wisdom and common sense that like to post
> > ridicule and abuse on this list. For goodness sake stop it and try to
> > write well instead.
>
> I'd rather write the truth, than something that feels nice.
>

There's a difference between being honest in a tactful and friend-winning
manner and being brutal. See:

* http://unarmed.shlomifish.org/909.html

* http://www.amazon.com/Feeling-Good-Therapy-Revised-Updated/d p/0380810336

* http://en.wikipedia.org/wiki/How_to_Win_Friends_and_Influenc e_People

* http://tldp.org/HOWTO/Encourage-Women-Linux-HOWTO/

> From shawn wilson <ag4ve.us [at] gmail.com>:
> > well, it is our culture. some fields have a culture of inclusion,
> > technology generally has a culture of exclusion.
>
> B U L L S H I T
>

There are much nicer ways to say it than that. You could have said "I don't=

think so." or whatever.

> Technology generally has a culture of honesty. If you do something stupid,
> you are told you are doing something stupid.
> Without undue care about your ego, working under the asumption that
> you are a mature person.
>
> Yes, there are other fields where people treat you nice and kind ...
> letting you shot yourself in the foot rather than appering rude by
> telling you something you might not like to hear.
>

There's a difference between telling someone he's done something wrong
(gently, tactfully, and with respect) then flaming him.

> From Alan Haggai Alavi <alanhaggai [at] alanhaggai.org>:
> > A mailing-list that welcomes new users and assists them is what I call
> > a 'healthy mailing-list'. Such lists will increase user
> > participation and eventually lead to the list being 'useful' to the
> > posters as well as to the community.
>
> I see. So you think a greeting and made up compliments are
> assistance?

That's not what he said.

>
> > Flaming is __HARM__ done to the community. No one enjoys it. It is the
> > best way to be destructive!
>
> Which is exactly why we should cut off this silly thread.
> Especially since the very first to flame in this thread was Shlomi
> Fish!

1. I wasn't the first to flame.

2. I did not flame. I told Uri that he should behave in a better way.

3. See http://en.wikipedia.org/wiki/Tu_quoque

>
> Let me quote again Uri's response:
> > NEVER do that for such a simple problem. eval string is a last resort
> > when no other technique can work well.
> >
> > and please learn to edit quoted email. there is no reason to see the
> > whole original email. also read a full thread before answering is a
> > good thing. this query was answered well several times already.
>
> Now that was incredibly rude. How could any human being write
> anything so insanely rude to another human being? Oh my gosh I'm
> gonna cryyyyyy!!!!

Uri was being very rude there - please don't play dumb.

Regards,

Shlomi Fish

=2D-
=2D--------------------------------------------------------- -------
Shlomi Fish http://www.shlomifish.org/
My Favourite FOSS - http://www.shlomifish.org/open-source/favourite/

Give me ASCII or give me dea=FE!

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Shlomi Fish [ Di, 19 April 2011 22:26 ] [ ID #2058388 ]
Perl » gmane.comp.lang.perl.beginners » Dynamic replacement of the variable

Vorheriges Thema: How do I get the content-disposition of a MIME::Entity part
Nächstes Thema: unable to print loader image properly until the backend process finishes.