basheer has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: selection folder in dir
by zentara (Cardinal) on Nov 01, 2011 at 12:04 UTC
    This isn't a free coding service, and usually we want to see some code from you, but based on your description of the problem, here is a start. You will need to use a graphical toolkit, like Tk, to get Checkbuttons.
    #!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Pane; my $topdir= shift || '.'; my @subdirs = get_sub_dirs($topdir); my $mw = tkinit(); $mw->geometry('400x400+100+100'); my $sp = $mw->Scrolled('Pane', -scrollbars=>'osoe', sticky=>'nwse') ->pack(-expand=>1, -fill=>'both' ); my @cbvalues; my @cbnames; my $count = 0; foreach my $d( @subdirs){ $cbnames[$count] = $d; $sp->Checkbutton(-text => $d, -font=>[arial => 12], -onvalue => 1, -offvalue => 0, -variable => \$cbvalues[$count], -font => 'big', -bg => 'white', )->pack(-anchor=>'w')->pack(); $count++; } my $showbutton= $mw->Button(-text=>'Show Selected', -bg => 'lightyellow', -command => sub{ my @selected = (); foreach my $c( 0.. $count ){ if ( $cbvalues[$c] ){ push @selected, $cbnames[$c]; } } print "@selected\n"; } )->pack(); MainLoop(); sub get_sub_dirs { my $dir = shift; opendir my $dh, $dir or die "Error: $!"; my @files = grep !/^\.\.?$/, readdir $dh; closedir $dh; my @sdirs; for my $file ( @files ) { if(-d $file){push @sdirs,$file;} } return @sdirs; }

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh