Re: truncating

2001-06-21 Thread Jos I. Boumans
altho this might surprise you, its as simple as: $foo = int rand 100; perl just Does The Right Thing =) Jos Boumans - Original Message - From: "Nick Transier" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 21, 2001 10:57 PM Subject: truncating > If I am generating

Re: truncating

2001-06-21 Thread Jeff 'japhy' Pinyan
On Jun 21, Nick Transier said: >If I am generating a random number with the rand function, how can I >truncate the resulting var to an integer? The int() function truncates a number to an integer. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ I am Marillion,

Re: truncating a string

2001-05-18 Thread Jeff Pinyan
On May 18, David Merrill said: >$title =~ s/\s*$//; > >where $title = "The Linux Programmer's Guide " > >and it is being truncated after the ' mark. All I want to do is remove >the trailing spaces from the string. Can someone please help? You've already solved your problem about single q

Re: truncating a string

2001-05-18 Thread Collin Rogowski
This should work! Can you give us a bit more context? To be precise: $title = "The Linux Programmer's Guide "; $title =~ s/\s*$//; That works. If you don't get "The Linux Programmer's Guide" there has to be something wrong in the code around that bit. cr On Fri, 18 May 2001 12:08:25

Re: truncating a string

2001-05-18 Thread David Merrill
On Fri, May 18, 2001 at 10:38:50AM -0500, John Joseph Trammell wrote: > On Fri, May 18, 2001 at 12:08:25PM -0400, David Merrill wrote: > > Hi, > > > > I'm working on my very first perl application, which is a front end to > > a database for the LDP. I am trying to truncate a string, using: > > >

Re: truncating a string

2001-05-18 Thread Gary Stainburn
Hi David, try this one. $title=~s/ *$//; it does an in-place search for all trailing spaces and replaces them with nothing. Gary On Friday 18 May 2001 5:08 pm, David Merrill wrote: > Hi, > > I'm working on my very first perl application, which is a front end > to a database for the LDP. I

Re: truncating a string

2001-05-18 Thread John Joseph Trammell
On Fri, May 18, 2001 at 12:08:25PM -0400, David Merrill wrote: > Hi, > > I'm working on my very first perl application, which is a front end to > a database for the LDP. I am trying to truncate a string, using: > > $title =~ s/\s*$//; > > where $title = "The Linux Programmer's Guide " >

Re: truncating a string

2001-05-18 Thread Jos Boumans
Try this: it just replaces MORE then one whitespace... $title = "The Linux Programmer's Guide "; $title =~ s/\s+$//; Regards, Jos David Merrill wrote: > Hi, > > I'm working on my very first perl application, which is a front end to > a database for the LDP. I am trying to truncate a