Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: print datafields separated by tab

by thinker (Parson)
on Aug 23, 2003 at 09:22 UTC ( [id://286034]=note: print w/replies, xml ) Need Help??


in reply to print datafields separated by tab

Hi bandya,

It looks as though your fieldnames have newlines embedded at the end.

If this is the case,what you want to do is

for (@fieldname){ chomp; # see perldoc -f chomp print "$_\t"; }

though it would be better to chomp fieldname when you put it into @fieldname.

Alternatively, combine the chomp with allolex's join method, and use

print join "\t", map { chomp; $_ }  @fieldname;

hope this helps

thinker

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-09-07 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.