Please forgive me for this qestion. I am a newbie and I wrote a script that is supposed to take an exported ascii file that contains a delimited list of id numbers, then cut out all the delimiters (these can include ,.;:|, newlines and tabs) and then it takes a substr of the id number (so if the file contains 1234, 2345 the results could be 23, 34). The issue is I cannot figure out how to split tas and newlines. I ave included the code below. Any help is greatly appreciated.
print "Please choose path to your ascii file:\n";
$ascii_path = <STDIN>;
chomp $ascii_path;
print "\n\nPlease choose a starting character postion:";
$start_char = <STDIN>;
chomp $start_char;
print "\n\nHow long should your finished string be...:";
$string_length = <STDIN>;
chomp $string_length;
$ascii_file = $ascii_path;
open(FILE1, $ascii_file);
while (<FILE1>)
{
chomp;
@LOAD1 = split(/\n/);
};
close(FILE1);
open(FILE2, ">$ascii_file new"
foreach $LOAD1 (@LOAD1)
{
chomp $LOAD1;
print FILE2 (substr("$LOAD1",($start_char-1),$string_length)).",\n";
};
print "\n@LOAD1";
<STDIN>;
print "Please choose path to your ascii file:\n";
$ascii_path = <STDIN>;
chomp $ascii_path;
print "\n\nPlease choose a starting character postion:";
$start_char = <STDIN>;
chomp $start_char;
print "\n\nHow long should your finished string be...:";
$string_length = <STDIN>;
chomp $string_length;
$ascii_file = $ascii_path;
open(FILE1, $ascii_file);
while (<FILE1>)
{
chomp;
@LOAD1 = split(/\n/);
};
close(FILE1);
open(FILE2, ">$ascii_file new"
foreach $LOAD1 (@LOAD1)
{
chomp $LOAD1;
print FILE2 (substr("$LOAD1",($start_char-1),$string_length)).",\n";
};
print "\n@LOAD1";
<STDIN>;