M
M
MDtox2018-05-20 17:08:27
Perl
MDtox, 2018-05-20 17:08:27

What's wrong with Perl?

$x = 0;
while($x <= 256) {
  chop;
  $x++;
print(chr($x)); 
}

Purpose: Display all ASCII characters in a column.
Result: It seems to have worked, but it is not displayed in a column and errors are still displayed below.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vaut, 2018-05-20
@MDtox

To display in a column, you need to add a line feed print("\n")after print(chr($x))
Why do you bite off the line feed character in the cycle from $ _ is not clear.
Perl could be much more concise:
foreach(1..256){print (chr."\n")}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question