I have a file consisting of a question on each line. I have created an array with the contents of this file. Some questions are having a \t or \n character.
my $filename_mh_sc_8_qnt = 'mh_science_8_qnt.txt'; open my $mh_sc_8_qnt, '<', $filename_mh_sc_8_qnt or die "Cannot open ' +$filename_mh_sc_8_qnt' for reading: $!"; my @Science = <$mh_sc_8_qnt>; my @shuffle = shuffle @Science; #shuffle the questions my $counter = 1; #number the question. foreach my $qnt (@shuffle){ print $counter, ". " . $qnt ."\n\n"; $counter++; }; print "\n";
The questions with \t and \n characters are not converting to tab and new line. example
Give reasons: \n\n\t(a) Grooves are made in tyres.\n\t(b) Gymnasts apply a coarse substance on their hands.How can print function convert the \t \n in such case. Thanks
In reply to print tab within an element of an array by oldmonk201
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |