vyeddula has asked for the wisdom of the Perl Monks concerning the following question:
contents of file(file.txt) to read.Read it vertically
apple snake cow dog
#!/usr/bin/perl -w use strict; open(FH,'<','file.txt') or die "File is not there $!\n"; my $count=1; while(<FH>) { print $count++; print ":$_"; }
output: 1:apple 2:snake 3:cow 4:dog
Output is as expected but my question is before apple why is it printing 1.I initialized count to 1 and entered the while loop and before printing content(at least the first one) there is count++ which it has to make it start from 2.I would like to know where i am making wrong assumption.Thanks
|
|---|