so if $a=wolf, I want to appent the characters .pl, so $a now equals wolf.pl. I tried this: $a = ${a}.pl;Why did you try that?
Did you ever run accross this error?perl -we"$a=wolf;die $a" Unquoted string "wolf" may clash with future reserved word at -e line +1. wolf at -e line 1.
How do you declare a string in perl?
$a and ${a} both refer to the scalar $a, and that part's understandable, but what did you think .pl would do?
The period (.) is the concatination perator, and it will concatinate $a and pl.
You should have seen this error before. What you're probably after is $a = "${a}.pl";perl -we"$a=1;$a=${a}.pl;print $a" Unquoted string "pl" may clash with future reserved word at -e line 1.
Where are you learning perl from?
Do you have a perl book?
What perl documentation have you read?
Good Advice and Maxims for Programmers
|
MJD says you can't just make shit up and expect the computer to know what you mean, retardo! ** The Third rule of perl club is a statement of fact: pod is sexy. |
In reply to Re: Appending characters to an existing string
by PodMaster
in thread Appending characters to an existing string
by wolverina
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |