what is the right way to get here a beautiful output ( all lines the same indent )?
#!/usr/bin/env perl
use warnings;
use strict;
use DBI;
my $phone_book =
#!/usr/bin/env perl
use warnings;
use strict;
use utf8; # This is to allow utf8 in this program file (as opposed to reading/writing from/to file handles)
binmode( STDOUT, 'utf8:' ); # Allow output of UTF8 to STDOUT
my @strings = ( 'Mühßig', 'Holler' ); # UTF8 in this file, works because of 'use utf8'
foreach my $s (@strings) { printf( "%-15s %10s\n", $s, 'lined up' ); } # should line up nicely
open( FILE, 'utf8file' ) || die("Failed to open file: $! $?");
binmode( FILE, 'utf8:' );
# Same as above, but on the file instead of STDIN
while() { chomp;printf( "%-15s %10s\n", $_, 'lined up' ); }
close( FILE );
# This works too
use Encode;
open( FILE, 'utf8file' ) || die("Failed to open file: $! $?");
while() {
chomp;
$_ = decode_utf8( $_ );
printf( "%-15s %10s\n", $_, 'lined up' );
}
close( FILE );