Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Missing \t in print output

by ww (Archbishop)
on Jul 14, 2015 at 18:24 UTC ( #1134775=note: print w/replies, xml ) Need Help??


in reply to Missing \t in print output

As I asked earlier,

HAVE YOU RE-READ perldoc -f join?
        and
WHERE DOES printflush COME FROM?

Answers:

  1. Here's what the join doc says (NB: "list"!):
    "join EXPR,LIST
    
    "Joins the separate strings of LIST into a single string with fields separated by the value of EXPR, and returns that new string. string. Example:
    
         $rec = join(':', $login,$passwd,$uid,$gid,$gcos,$home,$shell);
    
    "

    <UPDATE: In some cases, the use of double quotes instead of single quotes around the EXPR produces unexpected results. I'll try to create some relevant examples. </UPDATE>
     
  2. I still can't tell.

If my previous attempt (in the CB) to help was unclear or misleading, my apologies for the sharp tone here.

Replies are listed 'Best First'.
Re^2: Missing \t in print output
by Sophienz (Acolyte) on Jul 15, 2015 at 09:53 UTC

    Hi,

    Sorry if I misunderstood what you were asking earlier.

    1. I have read the documentation for join, and as far as I can tell, I'm doing it properly. I have tried changing the double quotes to single quotes but that actually made printed \t instead of the tabs themselves

    2. The printflush method comes from http://perldoc.perl.org/IO/Handle.html, which states that "$io->printflush ( ARGS ) Turns on autoflush, print ARGS and then restores the autoflush status of the IO::Handle object. Returns the return value from print."

    However, this doesn't make any difference to my output from when I just use print:

    my $printing = join("\t",@arrayToPrint); $normal_fh->print("$printing\n");

    Thanks for your help, I will update with any progress.

      Thank you for the clarification.

      But you never showed us parts of your code -- the hashbang, if any, and the use IO::Handle;. That would have forestalled my concern about the appearance of printflush without a predicate. Discipulus sussed that out, but obviously, I didn't... and, in any case, we often see problems such as using a function from a module without useing the module. Those cases make it very hard to help if the code presented isn't an exact copy of the code which generated anomalies or errors.

      BTW, the preceding para may have some value for you but I hope it also provides some benefit for future newcomers who stumble upon it.

      And, as has already been said, welcome to PM.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2021-01-22 01:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?