Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Find element in array

by clueless newbie (Deacon)
on Feb 17, 2020 at 00:51 UTC ( #11113031=note: print w/replies, xml ) Need Help??


in reply to Find element in array

#!/usr/bin/env perl # https://www.perlmonks.org/?node_id=11113020 use Data::Dumper; $Data::Dumper::Sortkeys=1; # make it easier +to find "things" in the "dumps" # Yes we'll take all the help we can get use strict; use warnings; # Read the data one line at a time while (<DATA>) { # Same as while +($_=<DATA>) { # And get rid of the $INPUT_LINE_SEPARATOR (\n); chomp; # Same as chomp( +$_); warn Data::Dumper->Dump([\$_],[qw(*_)]),' '; # Let's see what + we have ... there shouldn't be a trailing \n (my $bad=$_)=~ tr/[ATCG]/ /; warn Data::Dumper->Dump([\$_],[qw(*_)]),' '; # So all the val +id ones are gone if ($bad !~ m{^\s+$}) { # Are there any +bad ones? print "line: $.\n" # Yes - so print + the offending line number print "$_\n"; # The offending +line print "$bad\n"; # The offending +character(s) in the line $bad=~ s{\w}{print 1+pos($bad),','}eg; # Look for a "ch +aracter" if you find one print its "location' print "\n"; }; }; __END__ TAAGAACAATAAGAACAA TAAGAACAATAAUAACAA TAYGAACAkTAAGAACzz

Yields

perl 3020a.pl 2> nul TAAGAACAATAAUAACAA U 13, TAYGAACAkTAAGAACzz Y k zz 3,9,17,18,

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11113031]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2020-02-17 03:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (70 votes). Check out past polls.

    Notices?