I try used perl script to get characters from data:

#!/usr/bin/perl -w
use v5.14;
while (<DATA>){
    chomp;
    my $line = '';
    $line = (split //,@_)[5];
    print "it is $line.\n";
    }

__DATA__
Danio rerio strain Tuebingen chromosome 1 GRCz11 Primary Assembly
Danio rerio strain Tuebingen chromosome 2 GRCz11 Primary Assembly

the results is :
Use of uninitialized value $line in concatenation (.) or string at foundins.pl 
line 9, <DATA> line 1.
it is .
Use of uninitialized value $line in concatenation (.) or string at foundins.pl 
line 9, <DATA> line 2.
it is .

the aim for the work is to get the number for each line such as:
1 for first line and
2 for second lin

how can I correct my perl script?


Reply via email to