Recent content by thehobbit

  1. T

    How can I get Perl to open/make a .txt file using $input for the file name?

    In Perl, the command line arguments are stored in the @ARGV array. $#ARGV can get the number of arguments. #!/usr/bin/perl if ($#ARGV == 0) { die("Not enough arguments!"); } $input = shift @ARGV; open FILE, ">$input.txt" or die("Can't open input file: $!");
  2. T

    How do I delete the 1st line on a file using perl?

    You need to open the file, read the entire file, and print out all EXCEPT the first line to the desired output file. open INFILE, '<infile'; open OUTFILE, '>outfile'; <INFILE>; #discards first line print OUTFILE $_ while (<INFILE>); close OUTFILE; close INFILE;
  3. T

    How do I delete the 1st line on a file using perl?

    You need to open the file, read the entire file, and print out all EXCEPT the first line to the desired output file. open INFILE, '<infile'; open OUTFILE, '>outfile'; <INFILE>; #discards first line print OUTFILE $_ while (<INFILE>); close OUTFILE; close INFILE;
  4. T

    How do I delete the 1st line on a file using perl?

    You need to open the file, read the entire file, and print out all EXCEPT the first line to the desired output file. open INFILE, '<infile'; open OUTFILE, '>outfile'; <INFILE>; #discards first line print OUTFILE $_ while (<INFILE>); close OUTFILE; close INFILE;
  5. T

    How can I get Perl to open/make a .txt file using $input for the file name?

    In Perl, the command line arguments are stored in the @ARGV array. $#ARGV can get the number of arguments. #!/usr/bin/perl if ($#ARGV == 0) { die("Not enough arguments!"); } $input = shift @ARGV; open FILE, ">$input.txt" or die("Can't open input file: $!");
  6. T

    How can I get Perl to open/make a .txt file using $input for the file name?

    In Perl, the command line arguments are stored in the @ARGV array. $#ARGV can get the number of arguments. #!/usr/bin/perl if ($#ARGV == 0) { die("Not enough arguments!"); } $input = shift @ARGV; open FILE, ">$input.txt" or die("Can't open input file: $!");
  7. T

    How do I delete the 1st line on a file using perl?

    You need to open the file, read the entire file, and print out all EXCEPT the first line to the desired output file. open INFILE, '<infile'; open OUTFILE, '>outfile'; <INFILE>; #discards first line print OUTFILE $_ while (<INFILE>); close OUTFILE; close INFILE;
Back
Top