Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
i wanted to get the @pos as the immediate occurance after chr* as there are 2 such occurances in each line the first occrance has to be stored in pos[0] and second in pos1 for pos[0] pattern search has to be made wih in pos[0]+6 characters and same vs for pos1 but backwardsaanbb:anhn:iuopl:12345 chr1 12345 asnmkol * # kjiiii.....anmkij:lpolk: +lopll:abnnj chr5 123222 polko * dddfgg .... aaanbb:anhn:iuopl:aanjuj chr2 44345 asnmkol * # kjiiii.....anmkij:lpol +k:lopll:abnnj chr7 567222 polko * dddfgg .
ERRORSuse strict; use warnings; open (my $fhConditions, "<1.txt"); my $l=6; open (my $read, "<2.txt"); my @e = <$read>; my $d = join('', @e ); $d =~ s/\s+//g; while (my $line = <$fhConditions>) { chomp $line; my @pos = $line[$i] =~/chr*\s+(.+?)\s/g; if($pos[0] =/[0-9]/) { my $match = substr($d,$pos[0],$l) print "$line" if $match =~m/AAGCTT/; } if($pos[1] =/[0-9]/) { my $a = $pos[0]-$l; my $match = substr($d,$a,$l); print "$line" if $match =~m/AAGCTT/; } }
Global symbol "@line" requires explicit package name at restriction.pl + line 11. Global symbol "$i" requires explicit package name at restriction.pl li +ne 11. syntax error at restriction.pl line 15, near ") print" Global symbol "$match" requires explicit package name at restriction.p +l line 15.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to get rid of the errors in my perl script
by davido (Cardinal) on Aug 01, 2012 at 07:16 UTC | |
by Anonymous Monk on Aug 01, 2012 at 08:18 UTC | |
by ig (Vicar) on Aug 01, 2012 at 10:05 UTC | |
|
Re: How to get rid of the errors in my perl script
by Ratazong (Monsignor) on Aug 01, 2012 at 07:19 UTC | |
|
Re: How to get rid of the errors in my perl script
by Athanasius (Archbishop) on Aug 01, 2012 at 07:25 UTC | |
by Anonymous Monk on Aug 09, 2012 at 09:51 UTC | |
by Athanasius (Archbishop) on Aug 09, 2012 at 14:57 UTC |