Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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 chilling in the Monastery: (12)
As of 2014-12-25 04:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls