Return to Snippet

Revision: 41511
at February 19, 2011 03:45 by Mazzaroth


Updated Code
#------------------------------------------------------------------------------
# sub load_file_in_array():
#       Load a text file into an array. Remove all CR/LF.
#
sub load_file_in_array {
  (my $a_file) = @_;
  my @the_lines = ();
  
  unless ("$a_file" eq "")
  {
	  # load the test case file
	  if ($DEBUG > 1) { print "# loading the file '$a_file'\n" };
	  unless ( open ( FILE, $a_file ) )
	  {
	    die  "ERROR: $PROGNAME: Can't open '$a_file': $!";
	  }
	  @the_lines = <FILE>;
	  close FILE;
	  chomp(@the_lines);
	}
  return @the_lines;
}

Revision: 41510
at February 19, 2011 03:30 by Mazzaroth


Initial Code
#------------------------------------------------------------------------------
# sub load_file_in_array():
#       Load a text file into an array. Remove all CR/LF.
#
sub load_file_in_array {
  (my $a_file) = @_;
  my @the_lines = ();
  
  unless ("$a_file" eq "")
  {
	  # load the test case file
	  if ($DEBUG > 1) { print "# loading the file '$a_file'\n" };
	  unless ( open ( FILE, $a_file ) )
	  {
	    die  "ERROR: $PROGNAME: Can't open '$a_file': $!";
	  }
	  @the_lines = <FILE>;
	  close FILE;
	  chomp(@the_lines);
	}
  return @the_lines;
}

Initial URL


Initial Description
Load a text file into an array. Remove all CR/LF.

Initial Title
load_file_in_array()

Initial Tags


Initial Language
Perl