Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Conditional creation of files - global or scoped filehandle

by Anonymous Monk
on May 06, 2016 at 10:13 UTC ( [id://1162343]=note: print w/replies, xml ) Need Help??


in reply to Conditional creation of files - global or scoped filehandle

sure, its called functions

Main( @ARGV ); exit( 0 ); sub Main { my( $command, @args ) = @_; my %commands = ( example => \&Example, help => \&Help ); my $action = $commands{lc $command} || \&Help; $action->( @args ); } sub Example { my( $infile, $outfile ) = @_; use autodie; open my $out, '>', $outfile ; ... }
As you can see everything the Example option would do is done in a sub/function called Example

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1162343]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-19 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found