I've got a text file in this following format :

Field Data
1 2
1 3
1 4
2 5
2 6
3 2
3 3
3 4

I would like to open separate windows for each of the field...
meaning :
window1 (for field1) will display 2,3,4
window2 (for field2) will display 5,6
window3 (for field3) will display 2,3,4

I've read the file and load into two separate arrays - @field and @data.

I'm using window1 as the main window and the rest as toplevel windows.
I've managed to do window1 but the still having problem to proceed with the rest. Appreciate any snippets or guidance to start with as still new with Perl n Tk. Thanks in advance...

#!/usr/bin/perl -w
    use Tk;
    use strict;

    my $mw = MainWindow->new;
    fill_window($mw, 'Main');
    my $top1 = $mw->Toplevel;
    fill_window($top1, 'First top-level');
    my $top2 = $mw->Toplevel;
    fill_window($top2, 'Second top-level');

    sub fill_window {
        my ($window, $header) = @_;
        $window->Label(-text => $header)->pack;
            -text    => 'close',
            -command => [$window => 'destroy']
        )->pack(-side => 'left');
            -text    => 'exit',
            -command => [$mw => 'destroy']
        )->pack(-side => 'right');

This was taken from the module doc. on cspan TK module doc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.