Code:
perldoc -f split
perldoc -f split
$array1[$obj] = [($varible1, $variable2, $variable3)];
use warnings; use strict; use Data::Dumper; my @array = (0,0,0,1,1,1,1,2,3,3); my %hash; for (@array) { $hash{$_}++; } print Dumper(\%hash); __END__ $VAR1 = { '1' =>
use warnings; use strict; use File::Slurp; my $file = read_file('./test'); $file =~ s/(struct xyz.*?)unsigned x/$1unsigned m/s; print "$file\n";
my @lines = $telnet->cmd("ls");
use strict; use warnings; use YAPE::Regex::Explain; print YAPE::Regex::Explain->new(qr/^[^ ]/)->explain(); __END__ The regular expression: (?-imsx:^[^ ]) matches as follows:
use strict; use warnings; while (<DATA>) { my $motif = (split)[0]; print "$motif\n"; } __DATA__ small_motif_a CGTCGCACAGC small_motif_b CGTCGCACGAC small_motif_c CGTCGCCCAGC
use strict; use warnings; use List::MoreUtils qw(first_index); my @myarray = ("father","mother","sister","brother"); printf "item with index %i in list is sister", first_index { $_ eq 'sister' } @myarray; __END__ item with index 2 in list is sister
use lib "$ENV{HOME}/some_dir/lib";
my @today = Today(); my @date = Add_Delta_YMD(@today, 0,2,0); my $date_fmt = (split /\s+/, Date_to_Text(@date))[1]; print "2 months from now will be: $date_fmt\n";
use strict; use warnings; use Date::Calc qw(Today Add_Delta_YMD Date_to_Text); my @today = Today(); my @date = Add_Delta_YMD(@today, 0,2,0); print "2 months from now will be: ", Date_to_Text(@date), "\n"; __END__ 2 months from now will be: Thu 28-Oct-2010
Leave a comment: