Thanks for all!

2008/10/1 Andrew Smith <[EMAIL PROTECTED]>

> Hi Daniel
> You were caught by the trailing "\n" as John Krahn pointed out. insert a
> chomp $res; after your qx line or put a chomp around the qx statement.
> If you were to change your comparison to
> if ($res =~ /daniel/){ it would work without the chomp. I've attached my
> modified version of your code which I used to verify my thoughts.
>
> You should always  have
> use strict;
> use warnings;
>
> at the top of your code. With use warnings you can at a later stage use no
> warnings to turn them off around a bit of development test code.
> --
> Andrew
>
>
>
> Daniel Nascimento wrote:
>
>> Hello Andrew, thanks for your answer.
>>
>> I tried to do this way:
>>
>> *#!/usr/bin/perl -w
>>
>> $res = qx/whoami/;
>>
>> print $res;
>> print "-----------------\n";
>>
>> if ($res eq "daniel"){
>>    print "Welcome, ".$res." how are you?.\n";
>> }else{
>>    print "Your name isn't daniel\n";
>> }*
>>
>> when I executed this script I receive this output:
>>
>> [EMAIL PROTECTED]:~/Desktop$ perl teste.pl
>> daniel
>> -----------------
>> Your name isn't daniel*
>>
>>
>> What I did wrong? The script output doesn't should be "Welcome, daniel how
>> are you?"??
>>
>> PS: Sorry by my English. I'm not a good speaker... I'm learning yet.
>>
>>
>>
>
>
> --
> Andrew
>
>
>


-- 
Daniel Barbosa do Nascimento Filho
SQA - Analista de Qualidade
VirtualRox - Soluções Digitais
http://www.virtualrox.com

Reply via email to