|
| Author |
Message |
Calum Not Yet a God

Joined: 21 Feb 2004 Posts: 373 Location: england
   
|
Posted: Wed Apr 14, 2004 5:18 am Post subject: |
|
|
| Code: | | if ($msg =~ /^add (.*)/i) {<br />$msn->addcontact('$1');<br />&send($self,"I Have Added $1", "$username");<br />}<br /> |
that should work right??
trouble is it sends my bot offline but i get no errors
any ideas where im going wrong? |
|
| Back to top |
|
 |
eric256 The Keymaker

Joined: 03 May 2006 Posts: 2292 Location: Colorado
     
|
Posted: Wed Apr 14, 2004 5:28 am Post subject: |
|
|
Single qoutes mean it will not turn $1 into the real value. So you are saying add user $1 not add a user whos name is stored in $1. To test the idea try makeing a small script and doing
| Code: | | my $test = "hello";<br />print '$test' . "\n";<br />print "$test\n";<br /> |
_________________ Eric256
Proud previous owner and current admin of Bot-depot.com |
|
| Back to top |
|
 |
Calum Not Yet a God

Joined: 21 Feb 2004 Posts: 373 Location: england
   
|
Posted: Wed Apr 14, 2004 5:32 am Post subject: |
|
|
ok so im testing the difference between '' and "" ?
slightly strange way of learning
i didnt try it yet btw eric but i have now thanks for teaching me |
|
| Back to top |
|
 |
Calum Not Yet a God

Joined: 21 Feb 2004 Posts: 373 Location: england
   
|
Posted: Wed Apr 14, 2004 5:35 am Post subject: |
|
|
ahh i see
| Quote: | C:\Documents and Settings\calum\Desktop>perl test.pl $test hello |
so "" allows it to be a real value where as '' does not
thanks 
so the code would need to be | Code: | | if ($msg =~ /^add (.*)/i) {<br />$msn->addcontact("$1");<br />&send($self,"I Have Added $1", "$username");<br />} |
|
|
| Back to top |
|
 |
|