Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

pack mangles utf output

by roho (Monsignor)
on Aug 28, 2013 at 13:58 UTC ( #1051286=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
    my $x = 'FREIGHT  INTRASTATE';
    print $fh $x, "\n";
    print $fh pack('A20',$x), "\n";
    
  2. or download this
    ###################################################################
    # This subroutine pads 'txt' on the right to length 'len'.
    ...
       $len =~ s/^A//i;  # Remove 'A' that system "pack" function uses.
       return sprintf("%s%s",$txt, ' 'x(($len-length($txt))));
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1051286]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2014-09-17 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (95 votes), past polls