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

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.

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. If the string is longer than 34 characters, I'd like to save up to 35 characters to $var1, but cut off at the last possible space character

Re: String Manipulation

2007-08-08 Thread Dr.Ruud
Andrew Curry schreef: > /\s*(\S+)\s*=\s*(\S+)[,\s*\/*]?/ Anchored alternative: /^\s*(\w+)\s*=\s*(\w+)/ -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: String Manipulation

2007-07-31 Thread Dharshana Eswaran
Thanks Everyone for your suggestions. It really helped. I shall freshen up from the documents suggested to me. But anyways, i would like to say, that unless any one works on any language, mastering it is difficult. When i go through the tutorials or documents, i seem to know. But practically, onl

RE: String Manipulation

2007-07-31 Thread Andrew Curry
But in this case it was also not needed as I replied without actually reading the requirements. -Original Message- From: Paul Lalli [mailto:[EMAIL PROTECTED] Sent: 31 July 2007 14:21 To: beginners@perl.org Subject: Re: String Manipulation On Jul 31, 8:40 am, [EMAIL PROTECTED

Re: String Manipulation

2007-07-31 Thread Paul Lalli
On Jul 31, 8:40 am, [EMAIL PROTECTED] (Dharshana Eswaran) wrote: > And your suggestion worked. Thank you. But in the string which u had > suggested, [,\s*\/*]?, here \s* => tells spaces are optional, No it doesn't. The "dirty dozen" characters lose their special meaning inside of a character clas

Re: String Manipulation

2007-07-31 Thread Dharshana Eswaran
> > > -Original Message- > From: Dharshana Eswaran [mailto:[EMAIL PROTECTED] > Sent: 31 July 2007 13:17 > To: Perl Beginners > Subject: String Manipulation > > Hi All, > > I have a string which reads > $str5 = "DL_FEM_ADJ1 = DL_FEM_LINE_FIRST, /* Keep t

Re: String Manipulation

2007-07-31 Thread Rob Dixon
Dharshana Eswaran wrote: I have a string which reads $str5 = "DL_FEM_ADJ1 = DL_FEM_LINE_FIRST, /* Keep the adjacent ones consecutive */"; Here i need to consider the variable and its value, ignoring the comment. I have a pattern which reads if($str5 =~ /\s*([A-Z_]+)\s=\s(\w+),*/) { pr

RE: String Manipulation

2007-07-31 Thread Andrew Curry
Try if($str5 =~ /\s*(\S+)\s*=\s*(\S+)[,\s*\/*]?/) I cant see how your ([A-Z_]+) Will match your DL_FEM_ADJ1 as this has a number on it? -Original Message- From: Dharshana Eswaran [mailto:[EMAIL PROTECTED] Sent: 31 July 2007 13:17 To: Perl Beginners Subject: String Manipulation

String Manipulation

2007-07-31 Thread Dharshana Eswaran
Hi All, I have a string which reads $str5 = "DL_FEM_ADJ1 = DL_FEM_LINE_FIRST, /* Keep the adjacent ones consecutive */"; Here i need to consider the variable and its value, ignoring the comment. I have a pattern which reads if($str5 =~ /\s*([A-Z_]+)\s=\s(\w+),*/) { print "$1 and $2\n";

Re: String Manipulation

2007-06-28 Thread Jay Savage
On 6/27/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: On 6/28/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: > > On 6/27/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: > > > I am unable to get a generalised way in which it can extract them as few > > structures have comments, few does not hav co

Re: String Manipulation

2007-06-28 Thread Chas Owens
On 6/28/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: Thank you. But i am unable to understand the working of the code which you have written. Can you please explain it? Thanks and Regards, Dharshana What, specifically, do you not understand? -- To unsubscribe, e-mail: [EMAIL PROTECTED] Fo

Re: String Manipulation

2007-06-28 Thread Dharshana Eswaran
Thank you. But i am unable to understand the working of the code which you have written. Can you please explain it? Thanks and Regards, Dharshana On 6/28/07, Chas Owens <[EMAIL PROTECTED]> wrote: On 6/27/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: > On 6/28/07, Tom Phoenix <[EMAIL PROTECT

Re: String Manipulation

2007-06-27 Thread Chas Owens
On 6/27/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: On 6/28/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: > > On 6/27/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: > > > I am unable to get a generalised way in which it can extract them as few > > structures have comments, few does not hav co

Re: String Manipulation

2007-06-27 Thread Tom Phoenix
On 6/27/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: I am restricted from using modules and i am unable to come up with a regex or regexes to do this job. So, the Pointy-Haired Boss won't let you use any module that didn't come with Perl? Even if you can't use Parse::RecDescent in your fi

Re: String Manipulation

2007-06-27 Thread Dharshana Eswaran
On 6/28/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: On 6/27/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: > I am unable to get a generalised way in which it can extract them as few > structures have comments, few does not hav comments etc. Does the data have some defined grammar, or a defina

Re: String Manipulation

2007-06-27 Thread Chas Owens
On 6/27/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: snip Does the data have some defined grammar, or a definable one at least? If you are up to using Parse::RecDescent, it will probably do the job. snip Many people are afraid to use Parse::RecDescent because of the learning curve involved. I fi

Re: String Manipulation

2007-06-27 Thread Tom Phoenix
On 6/27/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: I am unable to get a generalised way in which it can extract them as few structures have comments, few does not hav comments etc. Does the data have some defined grammar, or a definable one at least? If you are up to using Parse::RecDesc

String Manipulation

2007-06-27 Thread Dharshana Eswaran
Hi All, I have a string in which structures are stored. Each time i read a file, different structure in stored in the string. The different possible structures stored in the string is as shown: $string = "{ STACK_CC_SS_COMMON_TYPE_REFERENCE_ID_Tpp_reference_id; STACK_CC_SS_COMMON_TYPE_

Re: Perl vs. Java for string manipulation & regex

2007-06-26 Thread Jenda Krynicky
whether he's really sure that it's more efficient to waste time with Java or to teach one more guy some Perl. > > 2. Does anyone know if the java would be significantly improved if I > > make use of regex instead of using substring functions? > > Why do you ask thi

Re: Perl vs. Java for string manipulation & regex

2007-06-24 Thread Tom Phoenix
On 6/24/07, Jeni Zundel <[EMAIL PROTECTED]> wrote: 1. Is the java significantly slower than the perl script because I suck at writing efficient java code or because perl is just really that much better at string manipulation? Yes. If it's important to determine how much of your

Perl vs. Java for string manipulation & regex

2007-06-24 Thread Jeni Zundel
t is significantly less efficient than the perl script. So my questions are: 1. Is the java significantly slower than the perl script because I suck at writing efficient java code or because perl is just really that much better at string manipulation? and 2. Does anyone know if the j

Re: direct string manipulation (like in c)

2004-08-19 Thread Christopher J. Bottaro
James Edward Gray II wrote: > Then you didn't read the documentation I sent you the link for. ;) > > A negative index counts backwards from the end of the string. i did read it. maybe i should have asked my question like this: "why is the 3rd argument negative when you can simply say: substr($

Re: direct string manipulation (like in c)

2004-08-19 Thread James Edward Gray II
On Aug 19, 2004, at 11:55 AM, Christopher J. Bottaro wrote: Gunnar Hjalmarsson wrote: You can use substr() as an rvalue: substr($str1, 4, 8 - length $str1, $str2); or if the length of $str1 is given: substr($str1, 4, -4, $str2);# probably fastest i don't understand why the 3rd

Re: direct string manipulation (like in c)

2004-08-19 Thread Christopher J. Bottaro
Gunnar Hjalmarsson wrote: > You can use substr() as an rvalue: > > substr($str1, 4, 8 - length $str1, $str2); > > or if the length of $str1 is given: > > substr($str1, 4, -4, $str2);# probably fastest i don't understand why the 3rd argument is negative. given $str1 = 'xxx

Re: direct string manipulation (like in c)

2004-08-19 Thread Gunnar Hjalmarsson
Christopher J. Bottaro wrote: say i have two strings "" and "". i want to replace characters 4-7 in the first string with the second string with an emphasis on speed. basically i want to do what can be done in c with the following: char str1[13] = ""; char *str2 = "

Re: direct string manipulation (like in c)

2004-08-19 Thread James Edward Gray II
On Aug 19, 2004, at 10:55 AM, James Edward Gray II wrote: On Aug 19, 2004, at 10:55 AM, Christopher J. Bottaro wrote: say i have two strings "" and "". i want to replace characters 4-7 in the first string with the second string with an emphasis on speed. perldoc -f substring Egad,

Re: direct string manipulation (like in c)

2004-08-19 Thread James Edward Gray II
On Aug 19, 2004, at 10:55 AM, Christopher J. Bottaro wrote: say i have two strings "" and "". i want to replace characters 4-7 in the first string with the second string with an emphasis on speed. perldoc -f substring Come back if you need a bigger hint. ;) James -- To unsubscrib

direct string manipulation (like in c)

2004-08-19 Thread Christopher J. Bottaro
say i have two strings "" and "". i want to replace characters 4-7 in the first string with the second string with an emphasis on speed. basically i want to do what can be done in c with the following: char str1[13] = ""; char *str2 = ""; strncpy(str1+4, str2, 4);

RE: String manipulation

2004-01-19 Thread Bob Showalter
Jerry Preston wrote: > Hi! > > I am trying to figure out a simple, Perl way to break down any sting > similar to the following: > > $s0 = > "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25, > 26,27,28,29"; > > Or in any numeric order. The string cannot be longer than

Re: String manipulation

2004-01-19 Thread Owen Cook
On Mon, 19 Jan 2004, Jerry Preston wrote: > I am trying to figure out a simple, Perl way to break down any sting similar > to the following: > > $s0 = > "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25, > 26,27,28,29"; > > Or in any numeric order. The string cannot b

String manipulation

2004-01-19 Thread Jerry Preston
Hi! I am trying to figure out a simple, Perl way to break down any sting similar to the following: $s0 = "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25, 26,27,28,29"; Or in any numeric order. The string cannot be longer than 55 characters and end with ",". Ex: $s

RE: help needed on text file/String manipulation

2003-06-14 Thread Charles K. Clarkson
Chinku Simon <[EMAIL PROTECTED]> wrote: : : I am facing a problem with text file manipulation : with Perl. : : I have a file with over 2 lac lines of data. Strange. It looks like you've posted a similar message yesterday, except that file had a lot more blank lines. Have you made no progre

help needed on text file/String manipulation

2003-06-14 Thread Chinku Simon
Hi, I am facing a problem with text file manipulation with Perl. I have a file with over 2 lac lines of data. I need to find the duplicates(strings) in the file and copy those records into another file. Is there a function/module in Perl by which I can read the duplicates in a file at one

RE: String manipulation problem

2003-03-14 Thread rbraswell
03 5:36 PM To: [EMAIL PROTECTED] Subject: Re: String manipulation problem [EMAIL PROTECTED] wrote: > Hi, > > While reading each line in a file, If I find a certain number, I need > to increment a digit within that number. For example, when reading > through my file, I expect t

Re: String manipulation problem

2003-03-12 Thread david
[EMAIL PROTECTED] wrote: > Hi, > > While reading each line in a file, If I find a certain number, I need to > increment a digit within that number. For example, when reading through my > file, I expect to find the following line. > > #define DS_FILEVERSION7,0,0,0462 > > What I want to d

Re: String manipulation problem

2003-03-12 Thread Rob Dixon
[EMAIL PROTECTED] wrote: > Hi, > > While reading each line in a file, If I find a certain number, I need > to increment a digit within that number. For example, when reading > through my file, I expect to find the following line. > > #define DS_FILEVERSION 7,0,0,0462 > > What I want to do is have t

RE: String manipulation problem

2003-03-12 Thread Bakken, Luke
> #define DS_FILEVERSION7,0,0,0462 > > What I want to do is have the ability to increment the first > two zero's > after the 7 on demand. I may accasionaly want to increment > the first zero, > making the number 7,1,0,0462, or a I may want to just > increment the second > zero, making t

RE: String manipulation problem

2003-03-12 Thread Hanson, Rob
27;, @nums); # returns the comma delimited nums } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 10:14 AM To: [EMAIL PROTECTED] Subject: String manipulation problem Hi, While reading each line in a file, If I find a certain number,

String manipulation problem

2003-03-12 Thread rbraswell
Hi, While reading each line in a file, If I find a certain number, I need to increment a digit within that number. For example, when reading through my file, I expect to find the following line. #define DS_FILEVERSION 7,0,0,0462 What I want to do is have the ability to increment the first two

Re: String manipulation benchmark

2003-01-08 Thread Jenda Krynicky
From: "John W. Krahn" <[EMAIL PROTECTED]> > Pavle Lukic wrote: > > Problem > > Given a string and a pattern, construct new string > > by removing part of the string equal to pattern. > > Remove only first occurrence of the pattern. > > > > Problem solutions > > > > Solution #1 ($x = $a) =~ s/\Q$b

RE: String manipulation benchmark

2003-01-08 Thread Dan Muey
nd perhaps why the second takes appx half the time to do? I'd love to understand this better. Thanks Dan -Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 9:37 AM To: [EMAIL PROTECTED] Subject: Re: String manipulation benchmark

Re: String manipulation benchmark

2003-01-08 Thread John W. Krahn
Pavle Lukic wrote: > > Hi Hello, > I did a little benchmarking in regard to the > string manipulation issue raised on this forum. > > Here are relevant parameters and benchmark results. > > Problem > Given a string and a pattern, construct new string > by removi

String manipulation benchmark

2003-01-08 Thread Pavle Lukic
Hi I did a little benchmarking in regard to the string manipulation issue raised on this forum. Here are relevant parameters and benchmark results. Problem Given a string and a pattern, construct new string by removing part of the string equal to pattern. Remove only first occurrence of the

RE: PERL string manipulation

2002-12-20 Thread Kipp, James
> vec() is a bit squirrelly. In a nutshell (heh), vec views its first > argument as a stream of bits taken from the string. The third > argument tells how many bits form a chunk. 8 bits gives chunks that > can each have values from 0 to 255. The second argument tells *which* > chunk, numbering

Re: PERL string manipulation

2002-12-20 Thread Randal L. Schwartz
> "James" == James Kipp <[EMAIL PROTECTED]> writes: >> vec( $output, length $output, 8 ) = ord "E"; James> is it just me or do others on this list have a tough time understanding the James> vec() function? vec() is a bit squirrelly. In a nutshell (heh), vec views its first argument as a stre

RE: PERL string manipulation

2002-12-20 Thread Mystik Gotan
ebmaster Insane Hosts) www.insane-hosts.net MSN: [EMAIL PROTECTED] From: "Kipp, James" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: RE: PERL string manipulation Date: Fri, 20 Dec 2002 08:29:14 -0500 > vec( $output, length $output, 8 ) = ord "E"; is it just me

RE: PERL string manipulation

2002-12-20 Thread Kipp, James
> vec( $output, length $output, 8 ) = ord "E"; is it just me or do others on this list have a tough time understanding the vec() function? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: PERL string manipulation

2002-12-19 Thread John W. Krahn
Colin Johnstone wrote: > > Gidday all, Hello, > In PHP if I want to add something to a string I do this > > $output = ""; > > $output .= "A"; > $output .= "B"; > $output .= "C"; > $output .= "D"; > > print $output; > > How do I do the same in PERL please. That does the same thing in perl:

RE: PERL String Manipulation

2002-12-19 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Let us know and maybe we can help. Wags ;) -Original Message- From: Johnstone, Colin [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 21:26 To: '[EMAIL PROTECTED]' Subject: RE: PERL String Manipulation Gidday All, Thank You for your help, I must have some other

RE: PERL String Manipulation

2002-12-19 Thread Johnstone, Colin
Gidday All, Thank You for your help, I must have some other error that I can't find. Regards Colin

RE: PERL string manipulation

2002-12-19 Thread Wagner, David --- Senior Programmer Analyst --- WGO
The same way. Wags ;) -Original Message- From: Johnstone, Colin [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 21:01 To: '[EMAIL PROTECTED]' Subject: PERL string manipulation Gidday all, In PHP if I want to add something to a string I do this

PERL string manipulation

2002-12-19 Thread Johnstone, Colin
Gidday all, In PHP if I want to add something to a string I do this $output = ""; $output .= "A"; $output .= "B"; $output .= "C"; $output .= "D"; print $output; How do I do the same in PERL please. Thanking you in anticipation Colin

RE: string manipulation

2002-05-02 Thread Jaimee Spencer
Thanks John, I may have to go along with Drieux and "Let it be known" YOU are The GOD of regEx! -Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 6:48 PM To: [EMAIL PROTECTED] Subject: Re: string manipulation Jaimee Spe

Re: string manipulation

2002-05-02 Thread drieux
On Wednesday, May 1, 2002, at 06:47 , John W. Krahn wrote: > Jaimee Spencer wrote: [..] >> >>I know I am missing something basic here also, but tell me in the >> example >> (my $projectId) = $projectDocDir =~ m!.*/(\w+)/!; >> why isn't the /1_0001.doc being printed as well? > > Because the

Re: string manipulation

2002-05-01 Thread John W. Krahn
Jaimee Spencer wrote: > > From: John W. Krahn [mailto:[EMAIL PROTECTED]] > > > > Either of these should work: > > > > (my $projectId) = $projectDocDir =~ m!.*/(\w+)/!; > > > > # or > > > > my $projectId = (split /\//, $projectDocDir)[-2]; > >I know I am missing something basic here also,

RE: string manipulation

2002-05-01 Thread Jaimee Spencer
EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 4:18 PM To: [EMAIL PROTECTED] Subject: Re: string manipulation Garrett Esperum wrote: > > Hi all, Hello, > I am using Solaris, Perl 5. > I am having some problems manipulating strings. > The string I am manipulating is: > >

Re: string manipulation

2002-05-01 Thread drieux
On Wednesday, May 1, 2002, at 04:18 , John W. Krahn wrote: > Garrett Esperum wrote: [..] >> >> /export/home/user/www/doc-root/dir/projects/19463/1_0001.doc >> >> $projectId = substr($projectDocDir, length($dir), index($projectDocDir, >> "/", >> length($dir))); you might want to perldoc File::B

RE: string manipulation

2002-05-01 Thread Jaimee Spencer
EMAIL PROTECTED] Subject: Re: string manipulation On Wed, 2002-05-01 at 18:52, garrett esperum wrote: > Hi all, > > I am using Solaris, Perl 5. > > I am having some problems manipulating strings. > > The string I am manipulating is: > > /export/home/user/www/doc-ro

Re: string manipulation

2002-05-01 Thread Chas Owens
On Wed, 2002-05-01 at 18:52, garrett esperum wrote: > Hi all, > > I am using Solaris, Perl 5. > > I am having some problems manipulating strings. > > The string I am manipulating is: > > /export/home/user/www/doc-root/dir/projects/19463/1_0001.doc > > I am trying to take out the "19463" part

Re: string manipulation

2002-05-01 Thread John W. Krahn
Garrett Esperum wrote: > > Hi all, Hello, > I am using Solaris, Perl 5. > I am having some problems manipulating strings. > The string I am manipulating is: > > /export/home/user/www/doc-root/dir/projects/19463/1_0001.doc > > I am trying to take out the "19463" part from the string and insert

string manipulation

2002-05-01 Thread garrett esperum
Hi all, I am using Solaris, Perl 5. I am having some problems manipulating strings. The string I am manipulating is: /export/home/user/www/doc-root/dir/projects/19463/1_0001.doc I am trying to take out the "19463" part from the string and insert it into a variable. Example of my code to do

Re: More string manipulation

2002-02-15 Thread Andrea Holstein
In article <00bb01c1b645$0b8eef80$[EMAIL PROTECTED]> wrote "Brian Johnson" <[EMAIL PROTECTED]>: > I have the following code that I need a little advice on. It'e easier for us all, if you short describe your problem. I assume that the following contains some errors, you can't find. > > The $re

RE: More string manipulation

2002-02-15 Thread Timothy Johnson
;,'Nov','De c'); #convert the date $threeLetterMonth = $mons[$record->{month}]; -Original Message----- From: Brian Johnson [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 9:20 AM To: [EMAIL PROTECTED] Subject: More string manipulation I have the follo

More string manipulation

2002-02-15 Thread Brian Johnson
I have the following code that I need a little advice on. The $record->{month} returns the month in integer format (ie 1, 2, 3), I need to change it to to a three letter string (ie Jan, Feb, Mar) foreach $item (@items) { my $record; my $test; foreach $record (@{$PDB->{records}}) {

Re: String manipulation help needed

2002-02-15 Thread Andrea Holstein
In article <[EMAIL PROTECTED]> wrote "Brett W. McCoy" <[EMAIL PROTECTED]>: > On Thu, 14 Feb 2002, Brian Johnson wrote: > >> I need a string in the form >> Wed, 18 Jul 2001 14:20 >> >> Of course my line doesn't quite cut it. >> my $emaildate = join " ", $record->{day}, $record->{month}, >>

Re: String manipulation help needed

2002-02-14 Thread Brett W. McCoy
On Thu, 14 Feb 2002, Brian Johnson wrote: > I need a string in the form > Wed, 18 Jul 2001 14:20 > > Of course my line doesn't quite cut it. > my $emaildate = join " ", $record->{day}, $record->{month}, > $record->{year}, $record->{hour}, $record->{minute}; Just interpolate the variables d

String manipulation help needed

2002-02-14 Thread Brian Johnson
I need a string in the form Wed, 18 Jul 2001 14:20 Of course my line doesn't quite cut it. my $emaildate = join " ", $record->{day}, $record->{month}, $record->{year}, $record->{hour}, $record->{minute}; I'm weak in string manipulation in perl - any h

Re: string manipulation (fwd)

2002-01-26 Thread Deen Hameed
30:56 +0530 (IST) From: Deen Hameed <[EMAIL PROTECTED]> To: Hubert Ian M. Tabug <[EMAIL PROTECTED]> Cc: Perl <[EMAIL PROTECTED]> Subject: Re: string manipulation something like this should work... (@somearray) = split(/\(.*\)/, $a); On Sat, 26 Jan 2002, Hubert Ia

Re: string manipulation

2002-01-26 Thread Jonathan E. Paton
> | Given the string: | | $a = "xxx xxx xxx xxx xxx xxx xxx (Jan 12 1990 ..)" | | I want to selectively extract that part of the string | having the (Jan 12 1990 ...) and store it in an array. | Can someone guide me? : : something like this should work... : : (@somearray) = split(/\(.*

Re: string manipulation

2002-01-26 Thread Deen Hameed
something like this should work... (@somearray) = split(/\(.*\)/, $a); On Sat, 26 Jan 2002, Hubert Ian M. Tabug wrote: > Hi, > > Given the string $a = "xxx xxx xxx xxx xxx xxx xxx (Jan 12 > 1990 ..)", I wan't to selectively extract that part of the string > having the

string manipulation

2002-01-26 Thread Hubert Ian M. Tabug
Hi, Given the string $a = "xxx xxx xxx xxx xxx xxx xxx (Jan 12 1990 ..)", I wan't to selectively extract that part of the string having the (Jan 12 1990 ...) and store it in an array. Can someone guide me? Thanks, Hubert

Re: string manipulation

2001-06-08 Thread Me
> Whats a bash prompt?? A shell prompt (bash is a 'shell'). Otherwise known as a command line. A place where you type in commands. I guess you ain't using a flavor of unix. If you're using Windows, you can do roughly the same thing as I suggested, only you'll need to fiddle with the characters

Re: string manipulation

2001-06-08 Thread Luinrandir Hernson
Whats a bash prompt?? Ok OK let me see if i have it the name of the string is EightyCharsLong $EightyCharsLong and the substr command is like the midstring command substr() I'm going to guess the first charecter is 0 so that 19 becomes the 20th position??? and of course the 10 is for the legt

Re: string manipulation

2001-06-08 Thread Me
> In BASIC there are commands for > leftstring, midstring, and rightstring. > I am looking for the perl equiv for these. > Lets say i have a string 80 charecters long and i > want to insert at string position 20 for 10 charecters. substr($EightyCharsLong, 19, 10) = 'morestring'; Yes, you ca

string manipulation

2001-06-08 Thread Luinrandir Hernson
OK.. thanks to all who helped me... i'm actually learning this thing... perl In BASIC there are commands for leftstring, midstring, and rightstring. I am looking for the perl equiv for these. maybe an example too??? not in butt tight code, but in line by line code so I can learn. THEN I'll