print "Please enter a temperature in Fahrenheit: "; chomp($f = <STDIN>); $c = ($f - 32) / 1.8; print "$f degrees Fahrenheit is $c degrees Celsius.\n";
$input1
$input2
$input1 and $input2, and the integers between them (hint: to do this correctly, you have to first determine which of the two variables has a greater value)
print "Please enter a positive integer: ";
chomp($input1 = <STDIN>);
print "Please enter another positive integer (different from the first): ";
chomp($input2 = <STDIN>);
if ($input1 > $input2) {
@numbers = ($input2..$input1);
}
else {
@numbers = ($input1..$input2);
}
$count = 0;
while ($count <= $#numbers) {
print "element $count is $numbers[$count]\n";
$count++;
}
$string
$string
$string (splitting on each colon), and assign the resulting array to @words
@words using a foreach loop
@words into $new, with a single space between each element
$new
Original Script:
#!perl
$string = "This:is:a:line:of:text";
print "$string\n"
split(/:/,$string) == @words;
foreach ($words) {
print "$words\n";
}
$new = join(@words, " ");
print '$new\n';
Fixed script:
#!perl
$string = "This:is:a:line:of:text";
print "$string\n";
@words = split(/:/,$string);
foreach $word (@words) {
print "$word\n";
}
$new = join(" ", @words);
print "$new\n";
for($i = 0; $i < 5; $i++) {
print "Please enter a word or integer: ";
$inputs[$i] = <STDIN>;
chomp($inputs[$i]);
}
@sortedInputs = sort(@inputs);
print "\nThe first input alphabetically is: $sortedInputs[0]\n";
print "The last input alphabetically is: $sortedInputs[$#sortedInputs]\n";
print "Type your input: "; chomp($input = <STDIN>); $input =~ s/bold/<B>bold<\/B>/gi; print "The revised input:\n"; print "$input\n";
print "Type your input: "; chomp($input = <STDIN>); $input =~ tr/[A-Z]/[a-z]/; print "The revised input:\n"; print "$input\n";
$list = "oranges 6 apples 11 bananas 7 cherries 5";
Your script should create a hash from this string, with each of the fruit names being a key in the hash, and the number following the fruit name being its corresponding value (hint: one approach to this would involve the use of split and while, there may be other approaches as well). Then print the key/value pairs of the hash. Do you know the reason why they didn't print in the same order you assigned them? Easy Solution:
$list = "oranges 6 apples 11 bananas 7 cherries 5";
@fruitArray = split(/ /, $list);
%fruitHash = @fruitArray;
while (($fruit, $howMany) = each(%fruitHash)) {
print "$fruit: $howMany\n";
}
Hard Solution:
$list = "oranges 6 apples 11 bananas 7 cherries 5";
@fruitArray = split(/ /, $list);
for($i = 0; $i <= $#fruitArray; $i++) {
if ($i % 2 == 0) {
$fruitHash{$fruitArray[$i]} = $fruitArray[$i + 1];
}
}
while (($fruit, $howMany) = each(%fruitHash)) {
print "$fruit: $howMany\n";
}
I'm not providing step-by-step instructions on how to do the final projects. Instead, I'm providing functional specifications for two different projects. You can review the two specifications and pick one to do as your final project.
These specifications describe the functions your application should be able to perform. Since this is probably your first time doing this sort of thing, the specifications also include implementation suggestions that contain some ideas on how to go about fulfilling the requirements.
Except for next week, when we'll install and configure the Apache web server on each lab computer, your remaining lab assignments will address one or more components of your project. During the labs I may provide additional implementation suggestions, and I'll be here to help you work through ideas.
Let's take a look at the specifications for the two available projects:
We'll start on the HTML work for the projects in tonight's lab. I'll be available during the lab to help you decide on a project if you're not sure which one you want to do.
A result of this implementation of hypertext on the Web is that many hypertext links are often outdated, or go nowhere due to poor maintenance. While this sometimes cause frustration for Web surfers, it's one of the key factors that has allowed the web to grow into a global publishing and communication medium.
Rather than trying to commercialize his software and ideas, he gave them away. This is another reason why the Web has become a global phenomenon: anyone with a computer can create an HTML document - you don't need to buy any special software or pay a fee to do it (although actually getting it on the web is another matter). He now oversees the World Wide Web Consortium, which manages the ongoing development of HTML.
<B>This text has bold tags around it</B>
<HTML>
<HEAD>
<TITLE>Put your title here</TITLE>
</HEAD>
<BODY>
<P>Put your page content in here.
<P><B>Here is some bold content.</B></P>
</BODY>
</HTML>
<A HREF="http://www.toppa.com/cis24/index.html">The CIS 24 Home Page </A>
The Form tag has one required attribute and several optional attributes. Tonight we'll focus on the required attribute, ACTION. The ACTION attribute specifies where the form data should be sent when the user submits it. For example:
<FORM ACTION="/cgi-bin/my_script.pl">
...input elements go here...
</FORM>
When the form data is received by the web server, it will direct the data to the location of the script or program you specify in the ACTION attribute. It will then be up to that script to figure out what to do with the data.
If you've decided to do the Calendar of Events, this week you should work on the HTML for the Calendar Management Page and Event Entry Page. If you've decided to do the Digital Camera Shopper, you can work on the Camera Search Page.