I'm trying to parse the domain name out of some URLs. In the example
data, my regex works fine on the first two URLs, but clips off the first
two characters of the domain on the third example. My regex probably
could be much better.
#!/usr/bin/perl
use strict;
use warnings;
my $regex = qr'
Owen wrote:
> I have this regex to look at an Apache log.
>
> m/^(\S+) \S+ \S+ \[(\d{2})\/(\S+)\/(\d{4}):.+\] "(\w+) (\S+)
> ([^"]+)" (\d{3}) (\d+|-) ".+"$/;
>
> Would like to set it out in a bit more readable form a la Perl Cook Book and
> others
>
> eg
>
> m/
> ^(\S+)# Commen
Owen wrote:
I have this regex to look at an Apache log.
There are modules to help with that task on CPAN.
m/^(\S+) \S+ \S+ \[(\d{2})\/(\S+)\/(\d{4}):.+\] "(\w+) (\S+)
([^"]+)" (\d{3}) (\d+|-) ".+"$/;
Would like to set it out in a bit more readable form a la Perl Cook Book and
others
eg
m
I have this regex to look at an Apache log.
m/^(\S+) \S+ \S+ \[(\d{2})\/(\S+)\/(\d{4}):.+\] "(\w+) (\S+)
([^"]+)" (\d{3}) (\d+|-) ".+"$/;
Would like to set it out in a bit more readable form a la Perl Cook Book and
others
eg
m/
^(\S+) # Comment
\S+# Comment
\S+
Thanks for the reply. I tried it out and it merely copies the file
from one directory to another, rather than to a directory named for
the author: in this case from
my $source_dir = '/usr/blah'; to
my $distin_dir = '/usr/blany/blanagain/';
with output like this:
Copying /usr/blah/htdocs/medi
> ""Beginner"" == "Beginner" <[EMAIL PROTECTED]> writes:
"Beginner"> "running xml2-config...failed
"Beginner"> The installed version of libxml2 not compatible with XML::LibXML."
It's not just a minimum. There are some versions of libxml2 that are
sufficiently broken that the the author of X
Ok, thank you all.
Finally I've done it like this:
use Encode;
use Encode::Guess;
my $decoder = guess_encoding($content);
print "UTF-8" if ref($decoder) eq 'Encode::utf8';
Octavian
- Original Message -
From: Igor Sutton
To: Octavian Rasnita
Cc: beginners@perl.org
Sent: Wed
Deepak Barua wrote:
>
> On 1/3/07, John W. Krahn <[EMAIL PROTECTED]> wrote:
>> Deepak Barua wrote:
>>
>> >I want to use a scalar variable with OR "|" operator embedded in
>> > the variable in a statement like
>> > $start_pattern = "\/\* \| \/\/";
>> >
>> > if(m/$start_pattern/ || $continue
Hi John,
I don't understand the script seems very cryptic, could
you explain
my $start_pattern = qr!/\*|//!;
Regards
Deepak
On 1/3/07, John W. Krahn <[EMAIL PROTECTED]> wrote:
Deepak Barua wrote:
> Hi,
Hello,
>I want to use a scalar variable with OR "|" operator embedded in
>
Dharshana Eswaran wrote:
>
> The output what i m getting is
>
> The input file contains message as follows:
>
> D0 1A 81 03 01 21 80 82 02 81 02 8D 0F 04 54 6F 6F 6C 6B 69 74 20 54 65 73
>
> Sample output:
>
> ENTER THE SEQUENCE between[1-3]:
> 2 1 1 3
>
> The output file contains:
>
> D01A81
Deepak Barua wrote:
> Hi,
Hello,
>I want to use a scalar variable with OR "|" operator embedded in
> the variable in a statement like
> $start_pattern = "\/\* \| \/\/";
>
> if(m/$start_pattern/ || $continue == 1) {
> $chosen_pattern = $&;
> Please inform me on how it is suppose
On 3 Jan 2007 at 8:02, Tom Messmer wrote:
> Hello everyone,
Hello and welcome,
> Just joined this list and I have a doozie I've been working on for a
> bit here to no avail. The entire problem is this; I have a list of
> files, say that they are named "flynn.foo, flynn_something.foo,
> fla
Hi,
I want to use a scalar variable with OR "|" operator embedded in
the variable in a statement like
$start_pattern = "\/\* \| \/\/";
if(m/$start_pattern/ || $continue == 1) {
$chosen_pattern = $&;
Please inform me on how it is supposed to work..?
Regards
Deepak
--
Code Code C
On 1/3/07, Octavian Rasnita <[EMAIL PROTECTED]> wrote:
From: "Jay Savage" <[EMAIL PROTECTED]>
> Try to unpack the data--or a chunk of data you feel is large enough to
> be representative--with the pattern U0U*. If the unpack succeeds with
> no warnings, you have valid utf8. You could try the same
Hello everyone,
Just joined this list and I have a doozie I've been working on for a
bit here to no avail. The entire problem is this; I have a list of
files, say that they are named "flynn.foo, flynn_something.foo,
flaherty.foo flaherty_something.foo" and so forth. Each of these
files mus
From: "Jay Savage" <[EMAIL PROTECTED]>
Try to unpack the data--or a chunk of data you feel is large enough to
be representative--with the pattern U0U*. If the unpack succeeds with
no warnings, you have valid utf8. You could try the same thing with
Encode's 'decode_utf8' routine. See perluniintro
2007/1/3, Octavian Rasnita <[EMAIL PROTECTED]>:
Hi,
I want to check if a certain string is UTF-8 or not.
Maybe you want Encode::Guess[1].
[1] http://search.cpan.org/~dankogai/Encode-2.18/lib/Encode/Guess.pm
--
Igor Sutton Lopes <[EMAIL PROTECTED]>
On 24 Dec 2006 at 12:23, Rob Dixon wrote:
> Randal L. Schwartz wrote:
> > "Rob" == Rob Dixon <[EMAIL PROTECTED]> writes:
> >
> > Rob> my @bad = $doc->findnodes(q{//address[starts-with(code, "BJPU")]});
> >
> > Actualy, doesn't that require code immediately below addess?
>
> Yes
>
> > Don't you
On 1/3/07, Octavian Rasnita <[EMAIL PROTECTED]> wrote:
Hi,
I want to check if a certain string is UTF-8 or not.
I have tried using is_utf8 from the Encode module, and utf8::is_utf8() but
the string is detected wrong.
For example, if I have a UTF-8 encoded file and an ANSI encoded file, if I
op
Hi,
I want to check if a certain string is UTF-8 or not.
I have tried using is_utf8 from the Encode module, and utf8::is_utf8() but
the string is detected wrong.
For example, if I have a UTF-8 encoded file and an ANSI encoded file, if I
open them both without "<:utf8", is_utf8 shows that the
Michael Alipio wrote:
> I have a folder named "myfolder"
> Inside "myfolder", I have several files named "ft1, ft2, ft3, ft4".
>
> I need to create symbolic links to all of those files into my current working
> directory.
>
> I tried creating a shell script:
>
> #!/bin/sh
> for i in /myfolder/f
On Wednesday 03 January 2007 21:02, Michael Alipio wrote:
> #!/bin/sh
> for i in /myfolder/ft* ; do ln -s ${i} ./; done
>
> But what it did was to create a symbolic link "ft*" pointing to
> /myfolder/ft*...
Not perl, but:
for i in /myfolder/ft* ; do ln -s ${i}; done
should do it, if I read you righ
I have a folder named "myfolder"
Inside "myfolder", I have several files named "ft1, ft2, ft3, ft4".
I need to create symbolic links to all of those files into my current working
directory.
I tried creating a shell script:
#!/bin/sh
for i in /myfolder/ft* ; do ln -s ${i} ./; done
But what it d
D. Bolliger am Dienstag, 2. Januar 2007 12:55:
> Dharshana Eswaran am Dienstag, 2. Januar 2007 08:02:
[snip]
> > $seq = ;
> > chop($seq);
> > @seq = split(/ +/, $seq);
> > $seq_len = @seq;
[snip]
> > for($i=0; $i<$seq_len; $i++) {
> > $read1[$i] = $table{$structure{$seq[$j]}};
> > syswrite
24 matches
Mail list logo