Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PERL

perl substitution

# Basic syntax:
$your_string =~ s/regex pattern/text to substitute/;
# Where:
#	- regex pattern is the pattern to search for in $your_string
#	- text to substitute is the replacement text when the pattern is found
# 	- add g after the last slash (/) to replace all matches for each line

# Example usage:
my $dna_sequence = "AACTAGCGGAATTCCGACCGT";
# substitute GAATTC with lowercase
$dna_sequence =~ s/GAATTC/gaattc/;
print "$dna_sequence
";
--> AACTAGCGgaattcCGACCGT
Source by korflab.ucdavis.edu #
 
PREVIOUS NEXT
Tagged: #perl #substitution
ADD COMMENT
Topic
Name
6+1 =