If you could focus your question more, it might help us to help you. What isn't working, exactly? What else have you tried? Have you inserted a few prints to help you in debugging (if you've got that far; under use strict and the -w switch your while loop is going to make the interpreter complain about not having declared $l -- not to mention that it's open not Open) Update I've been assured that it's $ one, not $ ell; I blame my fonts =)

Here are a couple of things to look at ..

Check out perldoc perlstyle ( or, on this site, perlman:perlstyle -- it can help you make your code more idiomatic -- in particular your filehandles look strange to a perl-er.)

A couple other general bits of advice: Perl isn't C; you don't have to treat strings as arrays of characters (strings are 'native' to Perl).

If you want to traverse a string character-by-character, you might look into using the substr function and a for loop (since you seem to be coming at this from a C background, I don't expect you'll have a huge problem with that =)..

Philosophy can be made out of anything. Or less -- Jerry A. Fodor


In reply to Re: ascii conversion by arturo
in thread ascii conversion by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.