tkly has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to read a file and print it, But I always get a junk value printed out in the first line.
Code:Output:#!/usr/local/bin/perl open (MYFILE, '2.pl'); print <MYFILE>; close (MYFILE);
How do i get rid of that first few junk characters? If i write onto another file instead of stdout this doesn't happen..#!/usr/local/bin/perl open (MYFILE, '2.pl'); print <MYFILE>; close (MYFILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl prints junk before file
by bart (Canon) on Feb 04, 2012 at 20:31 UTC | |
by tkly (Initiate) on Feb 04, 2012 at 21:21 UTC | |
by bart (Canon) on Feb 04, 2012 at 21:48 UTC | |
by tkly (Initiate) on Feb 04, 2012 at 21:52 UTC | |
by Anonymous Monk on Feb 05, 2012 at 06:13 UTC | |
|
Re: Perl prints junk before file
by oko1 (Deacon) on Feb 04, 2012 at 22:01 UTC | |
|
Re: Perl prints junk before file
by choroba (Cardinal) on Feb 04, 2012 at 21:07 UTC | |
|
Re: Perl prints junk before file
by chessgui (Scribe) on Feb 04, 2012 at 20:57 UTC |