In article <[EMAIL PROTECTED]>, Sara wrote:
> $TS = "THIS INPUT IS IN ALL CAPS";
>
> $TS_cont = lc $TS;
>
> $TS now prints out "this input is in all caps"
>
> What If I want first letter in caps for every word in string? which should
> be "This Input Is In All Caps"
>
> TIA,
>
> Sara.
perldo
On Wednesday, Jul 23, 2003, at 09:58 US/Pacific, Sara wrote:
$TS = "THIS INPUT IS IN ALL CAPS";
$TS_cont = lc $TS;
$TS now prints out "this input is in all caps"
What If I want first letter in caps for every word in string? which
should be "This Input Is In All Caps"
a way of solving this woul
At some point I really do need to read that damn regex book...pass the advil please.
http://danconia.org
On Wed, 23 Jul 2003 17:51:09 -0400, "Hall, Scott" <[EMAIL PROTECTED]> wrote:
> Sara,
>
> You can use "ucfirst".
>
> $TS =~ s/(\w+)/ucfirst l
Or you could do what Scott Hall said! :-)
Didn't know about that one...talk about making life easier.
-
Scot Robnett
inSite Internet Solutions
[EMAIL PROTECTED]
-Original Message-
From: Sara [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 23, 2003 11:59 AM
To: org
Subject: Another
On Wed, 23 Jul 2003 21:58:52 +0500, "Sara" <[EMAIL PROTECTED]> wrote:
> $TS = "THIS INPUT IS IN ALL CAPS";
>
> $TS_cont = lc $TS;
>
> $TS now prints out "this input is in all caps"
>
> What If I want first letter in caps for every word in string
#!/usr/bin/perl -w
my $TS = "THIS INPUT IS IN ALL CAPS";
my $lc_ts = lc($TS);
my @words = split(/\s+/, $lc_ts);
my @letters = ();
foreach my $word(@words) {
chomp($word);
if($word =~ /^(\w{1})(\w*)/) {
print uc($1) . $2 . " ";
}
else {
die "Something is seriously wrong here...";
}
}
Sara,
You can use "ucfirst".
$TS =~ s/(\w+)/ucfirst lc $1/ge;
Scott
-Original Message-
From: Sara [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 23, 2003 12:59 PM
To: org
Subject: Another Regex question.
$TS = "THIS INPUT IS IN ALL CAPS";
$TS_cont = lc $TS;
$TS now prints out "this
Andrew,
Thanks for trying to help.
Scot
-Original Message-
From: Andrew Brosnan [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 3:05 PM
To: Scot Robnett; [EMAIL PROTECTED]
Subject: RE: Another regex question
Try this:
#!/usr/bin/perl
#File:
use warnings;
use strict;
#set
Try this:
#!/usr/bin/perl
#File:
use warnings;
use strict;
#set slurp mode
undef $/;
my $stuff_i_want;
while () {#read in your file
#match up to Today's Headlines (or whatever)
if (/Today's Headlines:<\/strong>/) {
$stuff_i_want = $'; #put the rest in $stuff_i_want
}
..
-Original Message-
From: Andrew Brosnan [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 1:45 PM
To: Scot Robnett; [EMAIL PROTECTED]
Subject: RE: Another regex question
On 5/29/03 at 12:27 PM, [EMAIL PROTECTED] (Scot Robnett) wrote:
Will the file always be formated as below (wi
On 5/29/03 at 12:27 PM, [EMAIL PROTECTED] (Scot Robnett) wrote:
Will the file always be formated as below (with the blank line between
articles)? If so you could set the record separator '$/' to paragraph
mode to read each of them in:
# $/; #default is newline
# $/ = ""; # paragraph mode
I read perlfaq6. Several times, in fact, and specifically the section you're
pointing out. I'm one of those people who needs a good beating to understand
something, but once I "get it" I don't forget...just not there yet.
I basically want to extract the first several lines of the file, maybe to
di
On 5/29/03 at 11:22 AM, [EMAIL PROTECTED] (Scot Robnett) wrote:
> Okay,
>
> I've looked at perlre, perlretut, perldoc.com, Learning Perl, and a
> partridge in a pear tree, and I'm still stupid. :)
>
> Does anyone out there have a working example script that does
> matching over multiple lines, p
13 matches
Mail list logo