Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl tk question: pass value $filename 1 sub to the next sub

Status
Not open for further replies.

jfaulkner

Programmer
Jan 8, 2002
1
US
perl tk question:

how do I pass the value I get for $filename in the 1st sub(getListingX) - to the second sub(justTestX)? Please help, I am kind of new to perl.

sub getListingX {

my $filename = $BigFrame->getOpenFile();
if (-X $filename == "1" ) {
print "yippee it's an executable\n";
&justTestX;
}
elsif (-X $filename == "0" ) {
print ":( $filename is not executable";
&justTestX;
}
}
###############################################
sub justTestX (\$filename){
print "$filename\n\n";

}
 
Well this is more of a Perl question, but I'll answer it.

Here's the code:
Code:
sub getListingX {
    my $filename = $BigFrame->getOpenFile();
    if (-X $filename == "1" ) {
        print "yippee it's an executable\n";
        &justTestX($filename);
    } elsif (-X $filename == "0" ) {        
        print ":( $filename is not executable";
        &justTestX($filename);
    }
}
###############################################
sub justTestX ($){
    my $string = @_;
    print "$string\n\n";
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top