Matthew Stapleton wrote: > Hello, > > I am learning Perl and having some fun with it. In a script I am > writing I am wanting to read a line of a file and then extract a > digit from the beginning of the line. A typical line looks something > like this: > > 100. text text text > > So I am using a file handle to open the file and read the lines on by > one with a while loop. > > while (<TXT>){} > > That part is pretty straight forward. Each line is then given to $_ > Remove the line feed chomp; if ( /^(\d+)/ ) { # pulling mulitple digits from the beginning of the line $MyDigit = $1; }else { # No digit, what do you want to do } Wags ;)
> But how do I get just the digit at the beginning of the line out of > $_ ? I thought about adding zero to $_ and then passing this to > another variable but this does not seem to work. > > Can someone help me? > > Thanks, > > > Matthew Stapleton > > ############# > http://webpages.marshall.edu/~staple12 ********************************************************** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. **************************************************************** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]