I have a text file, and a function to retrieve from that text file:
@thefile = read_file( 'somepathfile' );
I would like to have a different implementation of the read_file function depending on which type is receiving the information.
So if I write:
%thefile = read_file( 'somepathfile' );
then a different function will be executed.
How do I do that?
While draegtun's answer illustrates a nice technique, I am going to recommend clarity. For example:
@thefile = read_file_lines( 'somepathfile' );
%thefile = read_file_pairs( 'somepathfile' );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With