Dear Tim,

I think your code is on the right track, as I got a modified
version of your code working.  I never use getc...

In C, where getc originates, the getc function returns a
char type.  The C char type is almost always 8 bits long.
By definition it doesn't support unicode, so neither does
Perl.  It would be nice if they told you though.

My inner loop was simply:

while (<INFILE>) {
    print OUTFILE join "-", /./g;
}

Which reads line by line, and outputs the line but with a 
dash between each character.

The /./g bit is using the regex engine to match a single
character, and the next etc.  It returns a list of characters.
Alternatively, and probably more readable, is split //

My simple test file included your example character, and
outputed:

H-e-l-l-o-§-W-o-r-l-d

Working character by character on an input stream is
extremely unpopular in perl.  Why do so when perl provides
a VERY powerful (ir)regular expression engine.


> > Why are you doing this?  Is most of your experience with C?
>
> I'm afraid to say that i do not qualify as a programmer having
> any knowledge at all.

You know where the beginners list is ;-)  I like the fact you have
worked on the problem first.  Minimum boilerplate for all scripts
should be:

use strict;
use warnings;

Documentation available via perldoc.

Jonathan Paton

-- 
#!perl
$J=' 'x25 ;for (qq< 1+10 9+14 5-10 50-9 7+13 2-18 6+13
17+6 02+1 2-10 00+4 00+8 3-13 3+12 01-5 2-10 01+1 03+4
00+4 00+8 1-21 01+1 00+5 01-7 >=~/ \S\S \S\S /gx) {m/(
\d+) (.+) /x,, vec$ J,$p +=$2 ,8,= $c+= +$1} warn $J,,

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to