if $s is the line of text then
$s =~ s/([^\t]*)\t/$1." "x(8-length($1)%8)/ge;
will replace all the tabs with spaces correctly inserted
On Sat, 26 Sep 1998, Graeme N Brown wrote:
> Dear list
>
> Can anyone explain why the following does not produce
> the result I expect ? My code fragment is
>
> #!/usr/bin/perl -w
> use strict ;
> use Tk ;
>
> my $MW = new MainWindow ;
> my $lb1 = $MW->Listbox(
> -selectmode => 'single',
> -width => 25,
> )->pack();
>
> $lb1->insert( 'end', "ABC\tGHI\tKLMNO") ;
> $lb1->insert( 'end', "FGH\tIJK") ;
>
> MainLoop ;
>
>
> I want to align groups of characters with Tab stops in
> each line of a Listbox, but apparently the "\t" are not interpreted as
> Tab characters but come out literally
> as '\t' viz.
>
> ABC\tGHI\tKLMO
> FGH\tIJK
>
> instead of
>
> ABC GHI KLMO
> FGH IJK
>
> Is there a way to achieve this ?
>
> TIA
> Graeme N Brown
> email: graeme...@btinternet.com
> ==========================================================================
> This message was posted through the Stanford campus mailing list
> server. If you wish to unsubscribe from this mailing list, send the
> message body of "unsubscribe ptk" to majo...@lists.stanford.edu
>
...../\/\/\.../\....../\./\/\/\... phi...@engin.umich.edu
...../\..../\./\/\..../\./\..../\. phi...@eecs.umich.edu
...../\/\/\/\./\../\../\./\/\/\/\. UNIVERSITY OF MICHIGAN
...../\......./\..../\/\./\....... Electrical Engineering & Computer Science
...../\......./\....../\./\....... Advanced Computer Architecture Lab
-- Phiroze N. Parakh
And the mingling of the water in the earth
is just like the blood in the body of man
==========================================================================
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majo...@lists.stanford.edu
If formatted output is your goal, using the Text widget may be better.
HTH
- Bob N.
:
> If formatted output is your goal, using the Text widget may be better.
I missed top-of-thread, but for columnar data you also next a fixed-width
font, not a proportional font.