This did the trick.

my @sixad = qq/\/etc\/init.d\/sixad start >tmp2/; system( @sixad );


Here is the updated code. I fixed it up a bit too.
use strict; use warnings; use diagnostics; use Tk; use Data::Dumper; require Tk::Pane; my $mw = MainWindow->new( ); $| = 1; $mw->geometry("300x300"); $mw->title("TkSixa"); $mw->protocol( WM_DELETE_WINDOW => \&ask, ); my $SixPairButton = $mw->Button( -text => "START", -command => \&sixpair, )->pack( -side => "top", -anchor => "nw", ); my $SixAdButton = $mw->Button( -text => "PAIR", -command => [ \&sixad, ] )->pack( -side => "top", -anchor => "nw", ); my $ClearButton = $mw->Button( -text => "CLEAR", -command => \&clear, )->pack( -side => "top", -anchor => "nw", ); my $QuitButton = $mw->Button( -text => "QUIT", -command => \&stopad, )->pack( -side => "top", -anchor => "nw", ); my $Pane = $mw->Scrolled( 'Text', Name => 'Display', -scrollbars => 'e', -relief => "sunken", -background => "WHITE" )->pack( -side => 'bottom', -fill => 'both', -padx => '5', ); sub warning { my $Tlw = $mw->Toplevel; $Tlw->title('Warning'); my $Label = $Tlw->Label( -text => 'Please connect controller before pa +iring.' )->pack( -side => 'top', -pady => '15' ); $Tlw->Button( -text => "OK", -command => sub { $Tlw->withdraw }, )->pack( -side => 'bottom +', -anchor => 'se', -padx => '5', -pady => '5' ); }; my @file1; my $OutFile1; my $Count = 0; sub sixpair { open $OutFile1, "+<", "tmp1", or die "Can't open file: $!"; @file1 = (); my @sixpair = qw(sixpair >tmp1); system( "@sixpair" ); while ( <$OutFile1> ) { push(@file1, $_); $Pane->insert("end", $_); } $Count = 1; return close($OutFile1); }; sub sixad { for my $t ( @file1 ) { if( $t =~ m/No controller found on USB busses./ ) { &warning; $Count = 0; return } } if ( $Count gt 0 ) { open my $OutFile2, "+<", "tmp2", or die "Can't open file: $!"; my @sixad = qq/\/etc\/init.d\/sixad start >tmp2/; system( @sixad ); while( <$OutFile2> ) { $Pane->insert("end", $_); } return; close($OutFile2); } else { &warning; return; } }; sub ask { my $Tlw = $mw->Toplevel; $Tlw->title('Prompt'); my $Label = $Tlw->Label( -text => 'Are you sure?' )->pack( -side => 't +op', -pady => '15' ); $Tlw->Button( -text => "Quit", -command => \&stopad, )->pack( -side => 'left', -anchor => 'sw', -padx => '5', -pady => '5', ); $Tlw->Button( -text => "Cancel", -command => sub { $Tlw->withdraw }, )->pack( -side => 'right' +, -anchor => 'se', -padx => '5', -pady => '5' ); }; sub clear { $Pane->delete('0.1', 'end'); }; sub stopad { my @stopad = qw/sixad --stop/; system(@stopad); exit 0; }; sub counter { $Count = '1'; }; MainLoop; =pod ## If your Bluetooth disappears or stops working run hciconfig hci0 up hciconfig -a if [[ $(hciconfig -a | grep -o "DOWN") ]]; then echo -e "\nBluetooth is off.\nTurning it on now.\n"; hciconfig set up; else echo -e "\nBluetooth is already on.\n"; fi =cut

In reply to Re: text from 2nd file not displaying in scrolledwindow by amboxer21
in thread text from 2nd file not displaying in scrolledwindow by amboxer21

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.