Re: Perl variable - cuts

2002-02-08 Thread John W. Krahn
"John W. Krahn" wrote: > > Chris Hurt wrote: > > > > Hi all; > > Hello, > > > Got a newbie question for you. I have a number of exactly 10 digits > > (2001090701) and I want to be able to read it from a file, cut the first 8 > > digits from the last two digits and put each into a variable (for

Re: Perl variable - cuts

2002-02-08 Thread John W. Krahn
Chris Hurt wrote: > > Hi all; Hello, > Got a newbie question for you. I have a number of exactly 10 digits > (2001090701) and I want to be able to read it from a file, cut the first 8 > digits from the last two digits and put each into a variable (for comparison > and addition). I would do it

RE: Perl variable - cuts

2002-02-08 Thread Mark Anderson
$num = 2001090701; if ($num =~ /(\d{8})(\d{2})/) { $fday = $1; $incr = $2; print "fday = $fday \t incr = $incr \n"; } else { print "$num is not in correct format\n"; } The regular expression /(\d{8})(\d{2})/ looks for 8 digits followed by 2 digits and stores the results (d