in reply to fibonacci numbers using subroutine?

Your program is aligned along the lines of
  1. Get input
  2. Calculate result
  3. Output result

A sub is identical. It takes in inputs in the form of arguments, does something, and returns some outputs.

You could move your entire code into a sub, but 1) you wouldn't learn anything, and 2) you want subs to do specific tasks, so you want to separate the keyboard input from the processing from displaying the result:

use warnings; use strict; print "Enter the number you would like to see in the sequence: "; my $number = <STDIN>; print(fibonacci($number), "\n");

Just move the rest into the sub, get the number from the argument list and return the result.