$l_number)
{
$l_status = 'TRUE';
last;
}
}
Or, for the memory conscious,
(since foreach involves loading all elements into memory)
$l_status = 'FALSE';
for (my $i=0; $i < @numbers; $i++)
{
if ($numbers[$i] == $l_number)
{
$l
> right now, I am doing this:
>
> while ($string =~ /pattern/g){
> $count++;
> if ($count > $max_count){
> $string = substr($string,0,pos($string));
> last;
> }
> }
How about:
$string =~ s/((.*?$pattern){$max_count})(.*)/$1/s;
George P.
>
> I k
d line, let it finish and rerun it
> manually every thing works fine (with some impact on resources which I
> can live with for the moment)
> How do I make it rerun?
> I tried wrapping the script in a
> while(1){
> use My::Module;
> some script
> exit;
Remove the
ave a better way?
> Thanks in advance,
> Dave
>
Have a look at
perldoc -q "How can I split"
George P.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
p.
>
> my $date = '03242003';
>
> $date = join '/', unpack 'a2a2a4', $date;
Excellent.
I had skimmed through pack and unpack, but there were no
important uses that I could find. So, I didn't pay much
attention to them.
The above example has made me t
e than once.
When you say $code =~ / HTTP\/\d\.\d\" (\d+)/;
$1 will contain the value captured by (\d+)
Therefore, you have to check in $1
A better way to do this would be,
if ($code =~ / HTTP\/\d\.\d\" (\d+)/)
{
print "The code is $1\n";
}
else
{
print &qu
t yourself.
I've never really worked with HTTP log data, but from the lines that
you've given, I would say:
my ($error_code);
if ($ln =~ / HTTP\/\d\.\d\" (\d+)/)
{
($error_code) = $1;
}
bye
George P.
>
> Thanks much,
> Derek
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Tue, 4 Mar 2003, Paul Johnson wrote:
>
> George P. said:
>
> > On Mon, 3 Mar 2003, Scott R. Godin wrote:
> >
> >>
> >> my @scores;
> >> my @files = glob "/home/johann/smail/Spam/*";
> >> foreach my $file (@files)
@param;
}
}
I used to use this logic to move through the command line
parameters. This was before I discovered Getopt
Hope it helps.
George P.
>
> Why doesn't the while loop iterate all of $rest? I can't seem to figure
> out how to get the loop to act on the entir
() or die()"
and
"close() or die()"
If open fails, the program will kill itself, so the close function
will never be called.
Therefore there is no need to say "close() or die()"
You've done it thrice in this email, so I'm presuming
that it's a habitual thing.
On Mon, 24 Feb 2003, Colin Johnstone wrote:
> Gidday all,
>
> >From this string I wish to return everything to the left of the last
> occurence of "." if it exists.
>
> string = "3.25.23.4";
my $string = "3.25.23.4";
my $ret = '';
$ret = $1 if ($string =~ /^(.*)\./);
print "$ret";
This will p
On Thu, 23 Jan 2003, Pam Derks wrote:
> Hi all,
>
> I want to grap the:
> last first middle(if any) email
> from a text file
>
> sometimes there is a middle intital, sometimes there isn't
>
> sample data:
> Smith, Mary [EMAIL PROTECTED]
> Jones, Tommy Lee [EMAIL PROTECTED]
>
> can someone sugges
On Wed, 22 Jan 2003, Rob Dixon wrote:
> Hi George. I think you'd have had an answer by now if there was
> one. I can't think of anything but I wasn't willing to post and say
> 'it can't be done' without waiting for others' ideas.
>
> George P. w
text" and also for classes like "text[0-9]+"
This has proven to be very useful.
But now, I need to check for all classes other than "text";
This has me stumped!!
For eg:
$str = '';
$class = 'text[0-9]+'
if ($str =~ /class="$class"/)
{
print "TAG has this class\n";
}
bye,
George P.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
YE, HI nor CIAO exists in $str.
I could've done something like:
if ($str !~ /$reg/)
{ ... }
but, I don't want to change the code, just $reg.
I've been trying to find something in Programming Perl,
but couldn't.
Does anyone know how you can do this??
Thanks.
George
perldoc -f ref
Example:
open ($fl, "/tmp/1.o");
if (ref($fl) eq 'GLOB')
{ print "Is a FILEHANDLE\n"; }
else
{ print "Isn't a FILEHANDLE\n"; }
I'm not very clear if GLOB is returned only for filehandles.
bye,
George P.
On Wed,
On Tue, 7 Jan 2003, Jenda Krynicky wrote:
>
> Since you are using MS Outlook I assume you want a Windows version,
> right?
>
Cool!!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
le'$_ = "This Is A Mixed Case Sentence.";
> s/([[:alpha:]])/$1 eq lc($1)?uc($1):lc($1)/eg; print'
> tHIS iS a mIXED cASE sENTENCE.
>
$ perl -le'$_ = "This Is A Mixed Case Sentence.";
print join"",map{$_=ord;$_+=$_>64 && $_<91 ? 32:$_>96 && $_<123 ? -32:0;chr} split //;'
tHIS iS a mIXED cASE sENTENCE.
George P.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
quot;//;
$text =~ s/"$//;
if ($num eq '010')
{ --- Do this ---}
else
{ --- Do this ---}
}
Bye,
George P.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Mon, 30 Dec 2002, Anand Ramakrishna wrote:
> if (-e "newfile.txt")
> {
> print "WARNING !! FILE newfile.txt already exists\n";
> print "Do you want to destroy all the contents and overwrite the file\n";
> print "Type Y for Yes or N or NO\n";
> $test = ;
>
E "$chrs";
Thanks again.
George P.
On Thu, 5 Dec 2002, Tanton Gibbs wrote:
> perldoc -q "How do I change one line in a file"
> - Original Message -
> From: "George P." <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday
Hi,
I am looking for a way to open a file in read/write mode,
seek to a particular position and then substitute a word
with another word.
The file is a simple text file.
Does anyone know how to do this ?
Thanks.
George P.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
On Tue, 29 Oct 2002, zentara wrote:
> On Mon, 28 Oct 2002 13:54:28 -0500, [EMAIL PROTECTED] (Nikola
> Janceski) wrote:
>
> >without using 'tail' how can I get the trailing 5 lines of a large file
> >quickly, without loading it all to memory?
> >
> >is there anyway without pop and shifting throu
Hi,
(taken frrom Programming Perl)
__BEGIN__
The our declaration declares a lexically scoped name
for a global variable, which is not itself a lexical variable
__END__
The part about the variable not being lexical variable can be
checked by printing $main::var.
However, what do you mean by a
Hi,
I want to write a .pl that will take in filenames as
parameters, and print out whether the files are text files
or binary files.
The problem I'm having is that I can't figure out a good rule
to use while deciding whether a file is a text-file or a binary-file.
If someone has created such a
On Thu, 10 Oct 2002, Javeed SAR wrote:
> Hi all,
>
>
> I want get the last part of this sentence excluding @@
> i.e i should get my output in a variable($put) like this for the following
> sentence:
>
> EnternalID_GetDateofBirth.vbp
>
>
> M:\jav_test\Technical_Docs\.@@\main\int_1_2b\techdoc_1_2
On Tue, 24 Sep 2002, David Samuelsson (PAC) wrote:
> I have an array with a lot of data.
>
> i want to remove certain elements from it:
> so i ran:
>for (@array){
>s/$current_user.*//;
>}
>
> nw when i print it, all $current user are gone as i wanted, but i
On Fri, 13 Sep 2002, Javeed SAR wrote:
>
>
> I have a statement as follows;
> I need to split them into 3 parts;
>
> * test_merge1 \\blrk35ed\views\test_merge1.vws
>
>
> LIke this:
> $var1 should have *
> $var2 should have test_merge1
> $var3 should have \\blrk35ed\views\test_merge1.vw
On Tue, 10 Sep 2002, Mike Singleton wrote:
> The output file (myfile.csv) is blank... any ideas out there? Thanks!
>
> === Start===
> use strict;
> my $JOBSTART = 'JOBSTART';
> my $CONDSTART = 'CONDSTART';
> my $JOBEND = 'JOBEND';
> my $CONDEND = 'CONDEND';
> my $JOBCANC = 'JOBCANC';
> my $XFER
29 matches
Mail list logo