[30770] in Perl-Users-Digest
Perl-Users Digest, Issue: 2015 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 28 21:19:41 2008
Date: Fri, 28 Nov 2008 18:19:25 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 28 Nov 2008 Volume: 11 Number: 2015
Today's topics:
how to force a symbolic link? <PengYu.UT@gmail.com>
Re: how to force a symbolic link? <tim@burlyhost.com>
How to get an array except the last element using slice <PengYu.UT@gmail.com>
Re: How to get an array except the last element using s (Vicky Conlan)
Re: How to get an array except the last element using s sln@netherlands.com
Re: How to get an array except the last element using s sln@netherlands.com
Re: How to get an array except the last element using s <tim@burlyhost.com>
Re: How to use special variable in regex? sln@netherlands.com
Re: my variable is recognized in following sub sln@netherlands.com
Re: negate a match in regex sln@netherlands.com
Re: what's so difficult about namespace? <timr@probo.com>
Re: what's so difficult about namespace? <lew@lewscanon.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 28 Nov 2008 17:39:01 -0800 (PST)
From: Peng Yu <PengYu.UT@gmail.com>
Subject: how to force a symbolic link?
Message-Id: <4564e995-a929-40c3-8ef1-fda8a3d36219@t3g2000yqa.googlegroups.com>
Hi,
In shell, 'ln' has an option -f. I'm wondering if there is such option
for symlink in perl.
Thinks,
Peng
------------------------------
Date: Fri, 28 Nov 2008 17:45:54 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: how to force a symbolic link?
Message-Id: <n91Yk.6094$no6.5058@newsfe04.iad>
Peng Yu wrote:
> Hi,
>
> In shell, 'ln' has an option -f. I'm wondering if there is such option
> for symlink in perl.
>
> Thinks,
> Peng
I don't see any mention of such an option. You could just have the perl
script use ln itself (with the option needed) if you want that feature.
Or, you could check if a symlink already exists and points where you
want, and if not, then take the appropriate action... unless some force
option does exist in symlink(), and I'm fairly sure it doesn't.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Fri, 28 Nov 2008 15:56:05 -0800 (PST)
From: Peng Yu <PengYu.UT@gmail.com>
Subject: How to get an array except the last element using slice?
Message-Id: <815b0f1c-5842-4e4c-959c-39cb239c88bb@41g2000yqf.googlegroups.com>
Hi,
I want to get an array without the last element. But it seems the last
line does not do what I want. I'm wondering what is the correct way to
do it.
Thanks,
Peng
#!/usr/bin/perl
use warnings;
use strict;
my @array = ('a' , 'b', 'c' , 'd');
print "@array\n";
print "@array[0,3]\n";
print "@array[0..2]\n";
print "@array[-1]\n";
print "@array[0..-1]\n"; #I want an array except the last element.
------------------------------
Date: Sat, 29 Nov 2008 00:00:58 +0000 (UTC)
From: comps@riffraff.plig.net (Vicky Conlan)
Subject: Re: How to get an array except the last element using slice?
Message-Id: <ggq0nq$1d5d$1@magenta.plig.net>
According to <PengYu.UT@gmail.com>:
>Hi,
>
>I want to get an array without the last element. But it seems the last
>line does not do what I want. I'm wondering what is the correct way to
>do it.
>
>print "@array[0..-1]\n"; #I want an array except the last element.
May not be the best way, but this should do what you want:
print "@array[0..$#array-1]\n"; #I want an array except the last element.
--
------------------------------
Date: Sat, 29 Nov 2008 00:03:32 GMT
From: sln@netherlands.com
Subject: Re: How to get an array except the last element using slice?
Message-Id: <9h11j4dc7qpqi3n9r0tvamlo4n2mhiulnp@4ax.com>
On Fri, 28 Nov 2008 15:56:05 -0800 (PST), Peng Yu <PengYu.UT@gmail.com> wrote:
>Hi,
>
>I want to get an array without the last element. But it seems the last
>line does not do what I want. I'm wondering what is the correct way to
>do it.
>
>Thanks,
>Peng
>
>#!/usr/bin/perl
>
>use warnings;
>use strict;
>
>my @array = ('a' , 'b', 'c' , 'd');
>
>print "@array\n";
>print "@array[0,3]\n";
>print "@array[0..2]\n";
>print "@array[-1]\n";
>print "@array[0..-1]\n"; #I want an array except the last element.
Why do you post here? Trying to construct test's for your
students, when your such a dumb-ass regals's in fraud.
Tell me where you teach, you will be fired tommorrow.
sln
------------------------------
Date: Sat, 29 Nov 2008 00:05:28 GMT
From: sln@netherlands.com
Subject: Re: How to get an array except the last element using slice?
Message-Id: <jp11j4dai90nig4d6o7r4ap9ogj978mmdl@4ax.com>
On Sat, 29 Nov 2008 00:00:58 +0000 (UTC), comps@riffraff.plig.net (Vicky Conlan) wrote:
>According to <PengYu.UT@gmail.com>:
>>Hi,
>>
>>I want to get an array without the last element. But it seems the last
>>line does not do what I want. I'm wondering what is the correct way to
>>do it.
>>
>>print "@array[0..-1]\n"; #I want an array except the last element.
>
>May not be the best way, but this should do what you want:
>print "@array[0..$#array-1]\n"; #I want an array except the last element.
Don't feed the troll !!
sln
------------------------------
Date: Fri, 28 Nov 2008 16:51:39 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: How to get an array except the last element using slice?
Message-Id: <wm0Yk.914$st1.364@newsfe10.iad>
Peng Yu wrote:
> Hi,
>
> I want to get an array without the last element. But it seems the last
> line does not do what I want. I'm wondering what is the correct way to
> do it.
>
> Thanks,
> Peng
>
> #!/usr/bin/perl
>
> use warnings;
> use strict;
>
> my @array = ('a' , 'b', 'c' , 'd');
>
> print "@array\n";
> print "@array[0,3]\n";
> print "@array[0..2]\n";
> print "@array[-1]\n";
> print "@array[0..-1]\n"; #I want an array except the last element.
try: @array[0..$#array-1]
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Fri, 28 Nov 2008 18:18:26 GMT
From: sln@netherlands.com
Subject: Re: How to use special variable in regex?
Message-Id: <67d0j45ni8s9m7t019rv4ujgpmdun46bjm@4ax.com>
On Fri, 28 Nov 2008 17:02:58 +0100, "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote:
>On 2008-11-27 06:53, John W. Krahn <someone@example.com> wrote:
>> That is short for:
>>
>> my @subset = grep( $_ =~ /^$_.+$/, @strings );
>>
>> So you are trying to match the current element of @strings against the
>> current element of @strings plus one character. And since the current
>> element of @strings cannot have more characters than the current element
>> of @strings it will never match.
>
>
>my @strings = ('a*');
>
>my @subset = grep( $_ =~ /^$_.+$/, @strings );
>foreach (@subset) {
> print "$_\n";
>}
>
> SCNR,
> hp
Yes, clever.
---------------------------
use strict;
use warnings;
my $elem0 = 'a*';
my @strings = ($elem0);
my @subset = grep( s/^($_)(.+)$/$1-$2/, @strings );
foreach (@subset) {
print "$_\n";
}
my $evalstr =
"
print \"\\\$elem0 = \$elem0\\n\";
if (\$elem0 =~ s/^($elem0)(.+)\$/\$1-\$2/)
{
print \"\\\$elem0 = \$elem0, \\\$1 = \$1, \\\$2 = \$2\\n\";
}";
print "\n$evalstr\n";
eval $evalstr;
__END__
a-*
print "\$elem0 = $elem0\n";
if ($elem0 =~ s/^(a*)(.+)$/$1-$2/)
{
print "\$elem0 = $elem0, \$1 = $1, \$2 = $2\n";
}
$elem0 = a*
$elem0 = a-*, $1 = a, $2 = *
------------------------------
Date: Fri, 28 Nov 2008 23:12:11 GMT
From: sln@netherlands.com
Subject: Re: my variable is recognized in following sub
Message-Id: <7gu0j4hs3rh2a6ibqjfaqcnd0q3cpmefd8@4ax.com>
On Thu, 27 Nov 2008 08:58:11 GMT, sln@netherlands.com wrote:
>On Wed, 26 Nov 2008 15:21:24 -0600, Tad J McClellan <tadmc@seesig.invalid> wrote:
>
>>sln@netherlands.com <sln@netherlands.com> wrote:
>>
>>
[snip]
>print $FunStuff::IwannaBeApackageGlobal3,"\n"; #[snip]
[snip]
Doesen't work, it doesn't work.
Thanks Tad,
Thanks Tad,
Thanks Tad,
Thanks Tad,
Thanks Tad,
Thanks Tad,
Thanks Tad,
Thanks Tad,
Thanks Tad,
Thanks Tad,
sln
------------------------------
Date: Fri, 28 Nov 2008 18:38:46 GMT
From: sln@netherlands.com
Subject: Re: negate a match in regex
Message-Id: <77e0j4t4p0m10vv2djg7aj8m39e3vij0p3@4ax.com>
On Thu, 27 Nov 2008 00:40:00 -0800 (PST), ikeon <shay.rozen@gmail.com> wrote:
>Hi All,
>I have a script that I convert xml tags to html. like "<" I convert to
>"<" and so on.
>after the conversion I need to capture the information inside the tag.
>let take for example the string "<abcd>: which is equivalent to
>"<abcd>".
>I tried to capture the "abcd" which can be different from tag to tag
>in the following way:
>
>/\<\;([^\&\gt\;]*)/
>
>like match "<" and then match anything that is not ">".
>the thing is that it doesn't work on all tags for some reason and I
>was wondering on a principal base if doing a [^somestring] suppose to
>work ?
>
>Thanks.
I'm still confused with your terminology 'xml tags to html'.
So be it.
How do you go from "<abcd>" to "<abcd>" without capturing
'abcd' ?
sln
------------------------------
Date: Fri, 28 Nov 2008 19:39:48 GMT
From: Tim Roberts <timr@probo.com>
Subject: Re: what's so difficult about namespace?
Message-Id: <j6i0j450b3mi151dinv6dlv9kc5uthirde@4ax.com>
Lew <noone@lewscanon.com> wrote:
>jon.harrop.ms.sharp@gmail.com wrote:
>> It's mostly a problem of culture.
>>
>> If you look, for example, at chinese [sic] names, the name space is not that
>> much important:
>> "Xee Laa" only takes this space:
>> " "
>> ^^^^^^^
>
>Chinese names are presumably not spelled with Roman letters in Chinese, so
>this really says nothing about how Chinese "wastes" space.
>
>> Instead, if you take a typical english [sic] name, say, "Abraham Lincoln",
>> you instantly recognize the waste of space used by this name:
>> " "
>> ^^^^^^^^^^^^^^
>
>How is that wasted? "Abraham Lincoln" is a longer name. Only one character
>is silent. In the transliteration you show for a Chinese name, two characters
>are wasted.
Caution: humor impairment detected. That's what Jon gets for not using
<parody> tags around his posting.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
------------------------------
Date: Fri, 28 Nov 2008 19:34:44 -0500
From: Lew <lew@lewscanon.com>
Subject: Re: what's so difficult about namespace?
Message-Id: <ggq2n4$mfp$4@news.albasani.net>
Tim Roberts wrote:
> Lew <noone@lewscanon.com> wrote:
>
>> jon.harrop.ms.sharp@gmail.com wrote:
>>> It's mostly a problem of culture.
>>>
>>> If you look, for example, at chinese [sic] names, the name space is not that
>>> much important:
>>> "Xee Laa" only takes this space:
>>> " "
>>> ^^^^^^^
>> Chinese names are presumably not spelled with Roman letters in Chinese, so
>> this really says nothing about how Chinese "wastes" space.
>>
>>> Instead, if you take a typical english [sic] name, say, "Abraham Lincoln",
>>> you instantly recognize the waste of space used by this name:
>>> " "
>>> ^^^^^^^^^^^^^^
>> How is that wasted? "Abraham Lincoln" is a longer name. Only one character
>> is silent. In the transliteration you show for a Chinese name, two characters
>> are wasted.
>
> Caution: humor impairment detected. That's what Jon gets for not using
> <parody> tags around his posting.
Caution: humor impairment detected. It wasn't funny.
--
Lew
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 2015
***************************************