Nov 29, 2012, 11:05 AM
Post #1 of 3
Beginning perl; subroutines
So I again, I come to the forums looking for programming guidance. The language that I'm specifically trying to work with today is Perl. So pretty much for my class we're being asked to read in from a file, print out to a new file and use a sub routine for the program. With my knowledge of other programming languages (very limited mind you) I got everything done, except for my sub routine.
My subroutine is supposed to from the read in file take the input for example 21-Nov-1995 and break down the whole numbers into digits and then provide some computations.
so for example 21 = 2 and 1, Nov would be 1 and 1 etc etc.
After reading the chapters this project is supposed to cover I've found not one way to split the digits apart. to be honest the only way I can personally think of based on my past classes would be using a delimiter and even then we haven't covered that in this class yet. So I guess there's a way to do it otherwise?
Any guidance of just how to split up my whole number would be really appreciated (any method or example would do honesty).
(This post was edited by shevik on Nov 29, 2012, 11:31 AM)