in reply to Binmode problem

:raw/binmode isn't even needed, although it doesn't hurt either.

>type 626330.pl open($fh, '>', '626330.txt'); print $fh "\t"; # or "\x09" or "\011" or pack('C', 9) >perl 626330.pl >dir 626330.txt ... 2007/07/12 06:20 PM 1 626330.txt <- file len = 1 ... >debug 626330.txt -rcx CX 0001 <- file len = 1 : -d100 l1 0AFD:0100 09 <- ASCII x09 = tab -q

I concur with grep. You loaded the file in an editor that converted the tab to spaces.

Replies are listed 'Best First'.
Re^2: Binmode problem
by arnk (Initiate) on Jul 13, 2007 at 13:58 UTC
    Thanks for the wisdom.
    Yes Slickedit was converting tab to spaces.
    In my real script which was a bit more complicated (creating wav files) than this example I was also using a printf of data containing %f which was interpreted as
    302E303030303030 hex or 0.000000
    which confused me. ie
    my @tmp = ( 0x25, 0x66 ); my $output = pack( 'C*',@tmp ); #print FILE $output; printf( FILE "$output" );

    Thanks again - all sorted now.
    Al