1827476 Members
2071 Online
109965 Solutions
New Discussion

Perl Question

 
SOLVED
Go to solution
Jason Berendsen
Regular Advisor

Perl Question

I am new to Perl and am looking for the equivalent command to the Unix cut command. I have a date in the format 020426 and want to cut the first to digits and put them in a variable called year. Is there an easy way in Perl to do this? Also, can you give any recommendations as to where I could find some good easy Perl example programs for me to work with?
2 REPLIES 2
harry d brown jr
Honored Contributor
Solution

Re: Perl Question

$year = substr(THATVAR,0,2)


substr(STRING, STARTINGPOS, LENGTH2CUT)


live free or die
harry
Live Free or Die
Jason Berendsen
Regular Advisor

Re: Perl Question

Thanks alot Harry that was exactly what I needed! Well worth 10 points.

Jason