[ create a new paste ] login | about

Link: http://codepad.org/pRlC9eKT    [ raw code | output | fork ]

Perl, pasted on Oct 15:
1
2
3
4
5
6
7
8
9
10
11
12
use strict;
use warnings;

my $string = 'MALWCMRALPLCLALALCAWGPDPACAFVN';
my @a = split(/A/, $string); 
my $join_A = join ("A,", @a);
my @starray = split(/,/, $join_A);

print "Enter L positions\n";
my @ARGV = <STDIN>;
my $regex = "^(.{" . $ARGV[0] . "}|.{" . $ARGV[1] . "})L" ;
my @selstrings = grep( /$regex/, @starray ) ;


Output:
1
2
3
Enter L positions
Use of uninitialized value in concatenation (.) or string at t.pl line 11.
Use of uninitialized value in concatenation (.) or string at t.pl line 11.


Create a new paste based on this one


Comments: