Gossamer Forum
Home : General : Perl Programming :

Perl Tabs

Quote Reply
Perl Tabs
Hi,
What's the perl sign for a tab?
We have a database that is a flat file text database seperated by a tab instead of say a :: .
So to tell the script that the delimiter is a tab, what is that bit of coding.

What we have now, is this:

@FIELD=split(/\::/,$data);
But need to change the :: to the correct thing for a tab.

Thanks if'n you can help.



------------------
Regards,
Visionary
Quote Reply
Re: Perl Tabs In reply to
A tab is \t. You'll have to escape the backslash with another one though, so your regex should read:

@FIELD=split(/\\t/,$data);

I'm no pro, but I reckon that's right...

adam
Quote Reply
Re: Perl Tabs In reply to
Close, you don't want to escape it. It should just be:

@FIELDS = split /\t/, $data;

By escaping it, you are actually splitting on a backslash followed by a t.

Cheers,

Alex