RE: String manipulation question

2009-04-22 Thread Wagner, David --- Senior Programmer Analyst --- CFS
> -Original Message- > From: Grant [mailto:emailgr...@gmail.com] > Sent: Tuesday, April 21, 2009 12:55 > To: Perl Beginners List > Subject: Re: String manipulation question > > >> >> >> Thanks guys.  With some help I've come up with this:

RE: String manipulation question

2009-04-22 Thread Wagner, David --- Senior Programmer Analyst --- CFS
> -Original Message- > From: Grant [mailto:emailgr...@gmail.com] > Sent: Tuesday, April 21, 2009 12:43 > To: Perl Beginners List > Subject: Re: String manipulation question > > >> >> Thanks guys.  With some help I've come up with this: > >>

RE: String manipulation question

2009-04-22 Thread Wagner, David --- Senior Programmer Analyst --- CFS
> -Original Message- > From: Grant [mailto:emailgr...@gmail.com] > Sent: Tuesday, April 21, 2009 12:16 > To: Perl Beginners List > Subject: Re: String manipulation question > > >> Thanks guys.  With some help I've come up with this: > >> > >

RE: String manipulation question

2009-04-22 Thread Wagner, David --- Senior Programmer Analyst --- CFS
> -Original Message- > From: Grant [mailto:emailgr...@gmail.com] > Sent: Tuesday, April 21, 2009 11:47 > To: Perl Beginners List > Subject: Re: String manipulation question > > >> I'd like to take a string and manipulate it in a few ways. > >> &g

RE: String manipulation question

2009-04-22 Thread Wagner, David --- Senior Programmer Analyst --- CFS
> -Original Message- > From: Grant [mailto:emailgr...@gmail.com] > Sent: Tuesday, April 21, 2009 09:58 > To: Perl Beginners List > Subject: String manipulation question > > I'd like to take a string and manipulate it in a few ways. > > If the string is 34 characters or less, I'd like to

Re: String manipulation question

2009-04-21 Thread Grant
>>> if you have in $string = q[1234 12345 12 5346 12367 123 123678123]; >>> Then $var1 will be '1234 12345 12 5346 12367 123 12367', but I thought you >>> wanted '1234 12345 12 5346 12367 123'? >>> Which one is the right one for what you are doing? >> >> You're right, I would want: >> >> 1234 12345

Re: String manipulation question

2009-04-21 Thread Grant
>> >> >> >> Thanks guys.  With some help I've come up with this: >> >> >> >> >> >> >> >> $string = 'abc def ghi jkl mno pqr stu vwx yz'; >> >> >> >> if(length($string) = 34) {$var1 = $string.":";} >> >> >> > >> >> >> > '=' is assignment, '==' is test for numerical equality. >> >> >> Change the abov

Re: String manipulation question

2009-04-21 Thread Jim Gibson
On 4/21/09 Tue Apr 21, 2009 11:54 AM, "Grant" scribbled: >> if you have in $string = q[1234 12345 12 5346 12367 123 123678123]; >> Then $var1 will be '1234 12345 12 5346 12367 123 12367', but I thought you >> wanted '1234 12345 12 5346 12367 123'? >> Which one is the right one for what you are

Re: String manipulation question

2009-04-21 Thread Jim Gibson
On 4/21/09 Tue Apr 21, 2009 11:42 AM, "Grant" scribbled: > I'm trying to pull 35 or fewer characters to the nearest space > basically. This is what I have now: > > if(length($string) <= 34) {$var1 = $string.":";} > if(length($string) > 34) { > ($var1, $var2) = ($string =~ /(.{35})(.{26})/);

Re: String manipulation question

2009-04-21 Thread Grant
>> >> >> Thanks guys.  With some help I've come up with this: >> >> >> >> >> >> $string = 'abc def ghi jkl mno pqr stu vwx yz'; >> >> >> if(length($string) = 34) {$var1 = $string.":";} >> >> > >> >> > '=' is assignment, '==' is test for numerical equality. >> >> Change the above >> >> > line to: >>

Re: String manipulation question

2009-04-21 Thread Grant
>> >> Thanks guys.  With some help I've come up with this: >> >> >> >> $string = 'abc def ghi jkl mno pqr stu vwx yz'; >> >> if(length($string) = 34) {$var1 = $string.":";} >> > >> > '=' is assignment, '==' is test for numerical equality. >> Change the above >> > line to: >> >    if( length($string

Re: String manipulation question

2009-04-21 Thread Grant
  $string =~ s/\s//g; >>> >>> The above line deletes all of the spaces in $string. Is that what you want >>> to do? >> >> All fixed up except for this.  How can I remove only the spaces at the >> end of $var1 and $var2 if they exist? > > Anchor your substitution regular expression to the end o

Re: String manipulation question

2009-04-21 Thread Jim Gibson
On 4/21/09 Tue Apr 21, 2009 11:16 AM, "Grant" scribbled: >>>   $string =~ s/\s//g; >> >> The above line deletes all of the spaces in $string. Is that what you want >> to do? > > All fixed up except for this. How can I remove only the spaces at the > end of $var1 and $var2 if they exist? Anc

Re: String manipulation question

2009-04-21 Thread Grant
>> Thanks guys.  With some help I've come up with this: >> >> $string = 'abc def ghi jkl mno pqr stu vwx yz'; >> if(length($string) = 34) {$var1 = $string.":";} > > '=' is assignment, '==' is test for numerical equality. Change the above > line to: >    if( length($string) == 34 ) { $var1 = $string

Re: String manipulation question

2009-04-21 Thread Jim Gibson
On 4/21/09 Tue Apr 21, 2009 10:46 AM, "Grant" scribbled: > Thanks guys. With some help I've come up with this: > > $string = 'abc def ghi jkl mno pqr stu vwx yz'; > if(length($string) = 34) {$var1 = $string.":";} '=' is assignment, '==' is test for numerical equality. Change the above line t

Re: String manipulation question

2009-04-21 Thread Grant
>> I'd like to take a string and manipulate it in a few ways. >> >> If the string is 34 characters or less, I'd like to append a colon >> character and save it to $var1. > > The length function will tell you how many characters are in a string. > >> >> If the string is longer than 34 characters, I'

Re: String manipulation question

2009-04-21 Thread Jim Gibson
On 4/21/09 Tue Apr 21, 2009 8:58 AM, "Grant" scribbled: > I'd like to take a string and manipulate it in a few ways. > > If the string is 34 characters or less, I'd like to append a colon > character and save it to $var1. The length function will tell you how many characters are in a string.