I got this question during perl test.
Write a program that accepts a number of ASCII values between 40 and 125 (both inclusive) and concatenates the corresponding characters to form a string. The program accepts a multi-line input. The first line contains a number representing how many ASCII values are in the input. The subsequent lines contain the ASCII values themselves (one ASCII value per line).
The following is an example of a valid input:
INPUT ------ 5 (this indicates the total number of ASCII values in the input set)
65
67
69
70
71
I have some other solution to this question. But i am very much confusing how to read multi line input in which the first line consider as number of times and subsequent lines contains ASCII values. I know my solutions is not correct, please help me in this regard.
#!/usr/bin/perl print "Enter the number of times : "; $times=<STDIN>; +@ascii=<STDIN>; foreach $s (@ascill) { print chr($s); }
I know the above solution is not suitable what question is asked above.
Thanks.In reply to Problem with reading multi-line by sarshads
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |