On Thu, Sep 30, 2010 at 23:21, Mark <herrpoe...@hailmail.net> wrote:
>  On 9/30/10 10:59 PM, Chas. Owens wrote:
>>
>> The only thing I can do to reproduce what you are seeing is to place a
>> control-d (aka ASCII character 4) in the file.  Try saying this
>>
>> echo 'print "hello\n"' | perl -
>>
>> If that works
>
>    It did.
>>
>> then try this:
>>
>> perl -nle 'print for grep { $_<  31 or $_>  126 } map ord, split //' t.pl
>>
>> It will tell use what control characters may be lurking in that file of
>> yours.
>
> Here is the output from the above command:
>
> 13
> 13
> 13
> 13
>
> What does that mean?
>
snip

Okay, here is what I think happened: you were print a carriage return.
 In UNIX, a carriage return (ASCII character 13) causes the cursor to
return to the beginning of the line.  You shell prompt then overwrote
the output of the program.  Try running your original file and piping
the output to a cat -v like this

perl test.pl | cat -v

That will cause control characters to be printed (rather than
interpreted as commands by the terminal).

Using a different editor does sound like the best course of action,
saving your files as UNIX text files (an option in some of the GUI
editors out there) is another good course of action.


-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to