polka4ever
Technical User
Hello, First of all, I open a file in Perl and then i use substr to pull out just a piece of each row in my flat file (which is fixed length). Now, I would like to get a count of that substr - that actually has values, that isn't empty or blank.
So I'm not sure which function to use. Here is what I have so far. Could someone point me in the right direction? It would be so very helpful!
$file = 'somefile.txt';
open(INFO, $file) or die "Can't open ...";
while (<INFO>){
chomp;
my $small_string = substr ($_, 168, 6);
print "$small_string\n";
}
So essentially, I want to get a count of all the $small_string - that actually have a value. I am a NOVICE - so just a little point in the right direction would be so entirely helpful.
Best,
Polka
So I'm not sure which function to use. Here is what I have so far. Could someone point me in the right direction? It would be so very helpful!
$file = 'somefile.txt';
open(INFO, $file) or die "Can't open ...";
while (<INFO>){
chomp;
my $small_string = substr ($_, 168, 6);
print "$small_string\n";
}
So essentially, I want to get a count of all the $small_string - that actually have a value. I am a NOVICE - so just a little point in the right direction would be so entirely helpful.
Best,
Polka