As others have pointed out you are using '=' instead of 'eq' eg: (if $type = "regular") instead of (if $type eq "regular"). By using '=' you are actually assigning the value "regular" to the variable '$type' as opposed to testing for its equality to something.
By consequence it will stop at the first "if" test (since $type is being immediately assigned to "regular", it is also immediately true that $type equals "regular") and so no matter what you actually type in for your gas type it will never get beyond the first "if" test for "regular". (i.e. it will never test for equality against "plus", "premium" or "diesel").
Remember that:
$blah = "something" will assign the variable $blah to the string "something".
if ($blah == 45) will test if the variable $blah is equal to the integer 45.
if ($blah eq "something") will test if the variable $blah is equal to the string "something".
A lot of these problems can be avoided by adding two lines to the start of every Perl program you write. A program, especially one written by a beginner, should contain the following lines after the she-bang line (the she-beng line is the very first line #!/usr/bin/perl of every perl script written for unix-like systems, windows systems should also include it):
use strict;
use warnings;
"use strict" forces you to declare all of your variables, this is a good thing and prevents mysterious bugs that can be difficult to trace due to typos in your variable names. "use warnings" will cause the perl compiler to "warn" you about the potential problem your program is experiencing (even though it is not necessarily an error).
If you include "use warnings" to the start of your program, when you execute the script it will display a message such as "Found = in conditional, should be ==".
This will alert you to the fact you need to change the '=' to something else, such as '==' and in your case, it will need to be changed to 'eq' because you are testing for the truth of a string ("something") and not an integer (45).
To repeat what others have said. In order to work properly, your program should resemble something like this:
#!/usr/bin/perl
use strict;
use warnings;
print "Which gas type will you be using?\n";
print "(Regular, Plus, Premium, Diesel)\n";
chomp (my $type =
);
if ($type eq "regular") {
# blah blah
}
elsif ($type eq "plus") {
# blah blah
}
# blah blah blah
Good luck!