IHYPRESS PROGRAMMING
Tutorials and Perl programs with code and output for beginners
Perl logo
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Perl ❯ Data Analysis
<13>
#!/usr/bin/perl -wT use CGI':standard'; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); print header(); print start_html(-title => "Data Analysis"); print "<div style='color:teal;'>"; my $sentence = "Get your kicks on Route 66!"; if ($sentence =~ m/kicks/){ print "The word <i>kicks</i> is in the sentence.<br>";} else{ print "The word <i>kicks</i> is not in the sentence.<br>";} print "</div>"; print "<div style='background-color:orange;margin-top:10px;'>"; $sentence =~ s/66/62/gi; $sentence =~ s/Get your kicks/I'll see you/gi; print "$sentence<br>"; print "$&<br>"; print "$' "; print "</div>"; print "<div style='color:green;margin-top:10px;'>"; my $record = "1,2,3,4,5,6,7,8,9"; my @pieces = split (/,/,$record); foreach my $piece (@pieces){ print "$piece - "; } print "</div>"; print "<div style='color:red;margin-top:10px;'>"; my $rec = '3434;Hammer;25;19.99'; my @pp = split (/er;/,$rec); foreach my $p (@pp){ print "&lt;$p&gt; "; } print "</div>"; my $s = 'Life is good!'; $s =~ s/good/excellent/i; print "<div style='color:blue;margin-top:10px;'>$s</div>"; print end_html();
Hergestellt in Deutschland / Made in Germany
Data Analysis
The word kicks is in the sentence.
I'll see you on Route 62!
Get your kicks
on Route 62!
1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 -
<3434;Hamm> <25;19.99>
Life is excellent!
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland