If you use $a instead of $alpha, then you won't get this message. ;)
I am using TinyPerl 5.8.0, so your code did not run on my PC, because you require Perl 5.12. Why do you do that? There are usually just small differences between versions, but if you could write a script that is compatible with older versions, then people with older machines could run your programs. So, I modified your code a little bit to make it run on my computer. For example, I changed the word "say" to "print" and I changed "require v5.12" to "use strict" so it runs fine now. I also changed the $alpha to $a Hehe
#!/usr/bin/perl use strict; use warnings; $a = chr(65); print "This is what Alpha looks like $a\n";
By the way, I would also like to show you a different way to accomplish the same output using the vec() function. Try this code:
#!/usr/bin/perl use strict; use warnings; $a = 'This is what Alpha looks like:'; # This instruction overwrites the 33rd # character in string $a with chr(65). # But since string $a is only 30 characters long, # it extends string $a with some spaces and then # writes chr(65) to position 32. The index starts # with 0, so "0" would be the first letter, and # "1" would be the second letter, and # "32" is the 33rd letter... vec($a, 32, 8) = 65; print $a, "\n";
In reply to Re: chr() function
by harangzsolt33
in thread chr() function
by catfish1116
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |