#! /usr/bin/perl -w

$a = 
    'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC' .
    'TTCTGAACTGGTTACCTGCCGTGAGTAAATTAAAATTTTATTGACTTAGGTCACTAAATACTTTAACCAA' .
    'TATAGGCATAGCGCACAGACAGATAAAAATTACAGAGTACACAACATCCATGAAACGCATTAGCACCACC';

if( 0 ) {
    if( $a =~ /CAT/ ) {
	print "\$a contains 'CAT'\n";
    }
}

if( 0 ) {
    if( $a =~ /CAT[GA]/ ) {
	print "\$a contains 'CATG or CATA'\n";
    }
}

if( 0 ) {
    $cnt = 0;
    while( $a =~ /CAT/g ) {$cnt++;}
    print "Found $cnt occurences of CAT\n";
}

if( 0 ) {
    print "Give search string> ";
    $str = <STDIN>; 
    chomp $str;
    $cnt = 0;
    while( $a =~ /$str/g ) {$cnt++;}
    print "Found $cnt occurences of $str\n";
}

if( 0 ) {
    print "All subseq between 'AAA' and 'AAA'\n";
    while( $a =~ /AAA(\w+?)AAA/g ) {
	print "$1\n";
    }
}

@arr = ('3', '3apa', 'apa3', '12', '-33', 
	'- 33', '2.34', '2.', '.34', '-.34', '-1.2E10', '.'); 


if( 1 ) {
    print "Is this a number?\n";
    foreach $num (@arr) {
	#if( $num =~ /\d/ ) {print "$num is a number!\n";}
	#if( $num =~ /\d$/ ) {print "$num is a number!\n";}
	#if( $num =~ /^\d$/ ) {print "$num is a number!\n";}
	#if( $num =~ /^\d+$/ ) {print "$num is a number!\n";}
	#if( $num =~ /^-?\d+$/ ) {print "$num is a number!\n";}
	#if( $num =~ /^(-\s*)?\d+$/ ) {print "$num is a number!\n";}
	#if( $num =~ /^(-\s*)?\d+(\.\d+)?$/ ) {print "$num is a number!\n";}
	#if( $num =~ /^(-\s*)?\d+(\.\d*)?$/ ) {print "$num is a number!\n";}
	#if( $num =~ /^(-\s*)?(\d+)?(\.\d*)?$/ ) {print "$num is a number!\n";}
	if( $num =~ /^(-\s*)?(\d+)?(\.\d*)?([eE]-?\d+)?$/ ) {print "$num is a number!\n";}
    }
}
