On 6 Oct 2014, at 18:57, punit jain contactpunitj...@gmail.com wrote:
Thanks Paul. However I think I couldnot explain the problem.
The issue is when I have mailid's as well as a part of input stream.
Input stream --- $str=ldap:///uid=user1,ou=People,o=test.com
On 14 Jul 2014, at 05:39, Shlomi Fish shlo...@shlomifish.org wrote:
don't use two-args open
perldoc -f open
In the one- and two-argument forms of the call, the mode and
filename should be concatenated (in that order), preferably
separated by white space.
On 14 Jul 2014, at 14:11, Shlomi Fish shlo...@shlomifish.org wrote:
perldoc -f open
This is irrelevant. Two-args open is dangerous - always use three-args open:
* http://perl-begin.org/tutorials/bad-elements/#open-function-style
Who wrote that? Ah...a certain Shlomi Fish.
open my $fh,
On 13 Jul 2014, at 21:43, ESChamp esch...@gmail.com wrote:
...lastname firstname other other other ... emailaddress
I wish to write a new file that contains only the emailaddress field
contents.
Here’s an easily-understood way of doing it:
#!/usr/bin/perl
use strict;
while (DATA){
On 13 Jul 2014, at 23:48, ESChamp esch...@gmail.com wrote:
John Delacour has written on 7/13/2014 5:31 PM:
On 13 Jul 2014, at 21:43, ESChamp esch...@gmail.com wrote:
...lastname firstname other other other ... emailaddress
I wish to write a new file that contains only the emailaddress
On 7 Jul 2014, at 09:18, Sunita Pradhan sunita.pradhan.2...@hotmail.com wrote:
I have a file of contents:
---
1 6
2 7
3 8
4 9
5 10
--
I want a file with content:
1 2 3 4 5
6 7 8 9 10
Try this:
#!/usr/local/bin/perl
use strict;
my (@col1, @col2);
while (DATA) {
On 30 Jun 2014, at 20:05, Jim Gibson jimsgib...@gmail.com wrote:
Try this:
$c = () = $line =~ /\b$w\b/g;
Or, slightly less obscure:
#!/usr/bin/perl
use strict;
my $line = one potato two potato three potato four;
my @hits = $line =~ /potato/g;
print scalar @hits; # = 3
#JD
--
To
On 22 Jun 2014, at 21:01, Sunita Pradhan sunita.pradhan.2...@hotmail.com
wrote:
I have following code for printing a simple hash.
#!/usr/bin/perl -w
%hash = (abc = 123, dfg = 456, xsd = 34);
foreach $k (keys %hash){
print key $k:: value $hash{$k}\n;
}
--
Use of
On 3 Sep 2013, at 18:08, Matt matt.mailingli...@gmail.com wrote:
It skips to the next item in the while loop of the string begins with
# and works fine. I would also like to skip to the next item in the
loop if the string contains anything other then lowercase,
underscores, numbers, dashes,
On 12/7/13 at 17:35, rvtol+use...@isolution.nl (Dr.Ruud) wrote:
perl -0 -wple 's/^start\n(.*?)\nend\n/$_=$1;y{\n}{ };$_\n/emgs'
Pure obfuscation! Why not keep things simple?! These stupid
one-liners are a pain in the brain.
#!/usr/bin/perl
use strict;
my @items;
while () { # or use a
On 24/6/13 at 06:36, l...@yun.yagibdah.de (lee) wrote:
while($test) {
last if($foo) {
print $bar;
}
else {
print $test;
}
}
doesn't work.
Never mind “doesn’t work”; it doesn’t compile, because
it is plain nonsense syntactically in whatever language.
Compare your meaningless string with
On 23/4/13 at 12:26, kavitahkulka...@gmail.com (kavita kulkarni) wrote:
Can you help me in finding the most time effective way to retrieve the
key-values from hash in the same sequence in which data is inserted into
the hash.
What about this? :
#!/usr/bin/perl
use strict;
my @array;
for (
On 22/02/2013 18:08, Tiago Hori wrote:
What I was wondering is: is there any way to force perl to use other line
ending characters, like MacOS C
The script below will first read the file for 1000 characters and set
the value of $/.
You can then loop through the lines in the usual way.
On 06/11/2012 10:19, Gary Stainburn wrote:
I'm writing a mail filter which accepts emails from our 'fax-to-email' gateway
and I'm struggling to handle the input. I'm getting the following:
Subject
=?ISO-8859-1?B?UmVjZWl2ZWQgRnJ...
Before you make a decision, read this from the MIME::Words
On 05/11/2012 03:01, hong zeng wrote:
When I run the send_email example on the website, I got some warning
like this...I am really a beginner so I don't know where to find the
answer so I post here. Thank you guys.
ece% perl ./perl_test/send_email.pl
Can't locate Email/MIME.pm in @INC (@INC
On 05/10/2012 04:14, Hal Wigoda wrote:
Who uses newsgroups anynore?
What reader application is the best for reading news groups?
If your ISP doesn’t provide a news feed then you can read usenet groups
in Google:
https://groups.google.com/forum/?fromgroups#!forum/comp.lang.perl.announce
If
At 18:38 + 1/11/11, Phil Dobbin wrote:
I use the /usr/local/ version for everything leave the other two
to their intended purposes. My question is how do I configure CPAN
to install into /usr/local/?
The way I do it is simply:
$ cd /usr/local/bin; sudo ./cpan
No disrespect to Perlbrew
At 10:33 + 13/10/11, Hamann, T.D. (Thomas) wrote:
...So I need something that does the equivalent of Don't match this
AND don't match this. Is this possible in a if loop, or should I
use something else?
for (qw (bcd 1num ASDSF two)){
print $_\n if !/^[0-9]/ and !/^[A-Z]+/;
}
JD
--
At 14:56 -0500 10/10/11, Chris Stinemetz wrote:
Once I match HEH how can alter the program to print the contents that
are in the two lines directly above the match?
If it's only one instance you need to deal with then this should do the trick:
#!/usr/bin/perl
use strict;
my @lines;
while
At 09:54 +0200 7/10/11, marcos rebelo wrote:
Unfortunatly someone has the code: use encoding 'utf8';
and now I get:
###
$VAR1 = {
'Subject' = \x{fffd}\x{fffd}my subject,
'CreationDate' = 'D:20111006161347+02\'00\'',
At 11:42 + 29/9/11, Hamann, T.D. (Thomas) wrote:
I need to write a regex that matches any single Greek letter
followed by a hyphen in a UTF-8 text file that is otherwise in
English.
How can I match the Greek alphabet (lower and upper case)?
#!/usr/local/bin/perl
use strict;
use utf8;
At 11:59 -0300 29/9/11, Brian Fraser wrote:
On Thu, Sep 29, 2011 at 10:58 AM, John Delacour
johndelac...@gmail.com wrote:
use encoding 'utf-8';
Nitpick: Please don't use this, as encoding is broken. use utf8; and
use open qw :std :encoding(UTF-8) ; should make do for a
replacement
At 17:29 -0300 29/9/11, Brian Fraser wrote:
On Thu, Sep 29, 2011 at 4:03 PM, John Delacour johndelac...@gmail.com wrote:
Nitpick: Why the upper-case charset name?
Uppercase is UTF-8-strict, while lowercase is the lax version that
perl uses internally. Unless you are passing data from one
At 15:33 +0300 13/09/2011, Shlomi Fish wrote:
...For more information see:
http://perl.plover.com/FAQs/Namespaces.html
Useful article.
Now can you explain why I get no error with this little routine? -
#!/usr/local/bin/perl
use strict;
$a = 1;
$b = 2;
At 16:39 -0500 13/09/2011, Chris Stinemetz wrote:
From Learning Perl book:
In some circumstances, $a and $b won't need to be declared, because
they're used internally by sort. So if you're testing this feature,
use other variable names than those two. The fact that use strict
doesn't forbid
At 17:53 -0500 17/08/2011, Bryan R Harris wrote:
How can I do a 3-argument open on STDIN? This doesn't work because the
3-argument open won't open STDIN when you tell it to open -.
**
@files = (-);
for (@files) {
print reverse readfile($_);
}
[...]
At 03:40 -0700 12/06/2011, eventual wrote:
I've read perldoc File::Find but I dont understand.
So If I wish to search for mp3 in d:\ and all its sub-directories,
and to print it out if found,
How should I write?
Just put the directory in $dir:
#!/usr/local/bin/perl
use strict;
use
At 08:28 -0700 10/06/2011, Gurpreet Singh wrote:
Correct me if i am wrong -
$read = 0 unless /\s[A-Z]{3}:/;
This might pick up wrong values also - since one of the DBLINKS data
(the first record) might also get picked up - it should match this
regex.
Run my script with the data and see.
At 18:50 -0400 09/06/2011, Uri Guttman wrote:
...i don't know the data logic so i can't go further. at least you
can run this and assign it to $read to remove redundancy. also you
can declare $read here.
my $read = s/^GENES//;
No it isn't. If you don't know the data logic then
At 10:48 +0200 09/06/2011, venkates wrote:
I need to retrieve all the gene entries to add it to a hash ref.
Your code is very fussy with all those substrings etc. What about
something like this:
#!/usr/local/bin/perl
use strict;
my $read = 0; my @genes; my %hash;
while (DATA){
chomp;
At 22:33 -0400 04/06/2011, Brandon McCaig wrote:
On Fri, Jun 3, 2011 at 1:14 PM, John Delacour johndelac...@gmail.com wrote:
I made it clear that I am serving the page dynamically from cgi-bin. Here is
an example:
That part is irrelevant though because the image file is loaded by the
user
At 12:11 -0400 03/06/2011, Brandon McCaig wrote:
It would probably help if you could show us a simple example of what
you're trying and what is wrong with it. :)...
For example, if the current Web page is http://foo/bar/baz.html
I made it clear that I am serving the page dynamically from
I have a script in cgi-bin which gathers information from the user
and replaces placeholders in a pre-written html page with the data
collected via a different html interface. Since the script needs to
run from various servers I don't want to use absolute URIs for the
images, css file etc.
At 13:39 +0300 12/04/2011, Shlomit Afgin wrote:
I need to write regular expression that will capitalize the first
letter of each word in the string.
Word should be word that her length is greater or equal to 3 letters
exclude the words 'and' and 'the'.
I tried:
$string = lc($string);
At 23:00 +0300 14/04/2011, Shlomi Fish wrote:
In Perl, I don't encourage people using goto statements, and I did not find a
use for them in Perl, yet. But I don't rule out that they have legitimate use
in other languages...
CODE
int alloc_stuff(struct_t * * ref)
{
Let's stick to Perl and
At 03:14 -0500 12/03/2011, Uri Guttman wrote:
this replaces the entire if/else statement:
$hash{$item}++ ;
...it is a standard perl idiom you need
to know so you don't waste code like that.
Nice!
so
#!/usr/local/bin/perl
use strict;
my %hash;
my @array = split //, 12342312111467;
At 22:33 + 28/02/2011, Rob Dixon wrote:
The complete program is below.
HTH,
Rob
use strict;
use warnings;
my %HoA;
while ( DATA ) {
my ($swit, $server, $ip_range) = split;
my ($b_real_ip, $b_ip, $e_ip) = $ip_range =~
/(\d+\.\d+\.\d+\.)(\d+)-\1(\d+)/;
for my $byte ($b_ip ..
At 12:06 -0800 26/02/2011, Richard Green wrote:
chr1ucscexon226488874 226488906 0.00
- . gene_id NM_173083:12345; transcript_id NM_173083:12345;
chr1ucscexon226496810 226497198 0.00
- . gene_id NM_173083:12345;
At 12:57 -0800 26/02/2011, Richard Green wrote:
What is $gene_id?
Are you by any chance using '$' at the beginning of your search
pattern instead of the end?
I have $ to designate the end of the row
$gene_id
$gene_id designates $gene_id period.
Why are you escaping the quote marks?
At 07:11 -0800 05/02/2011, zavierz wrote:
Here's code which was suggested to me, but when I execute it I'm
returned to the command line and nothing happens:
#!/usr/bin/perl
s/^(Article\s+[0-9]+\s+\N*\S)/\\subsection*{$1}/gm
I called this script Article and saved it as article.pl
The
At 14:22 +0200 07/02/2011, Shlomi Fish wrote:
Hi John,
a few comments on your code.
Actually, see perldoc perlrun - http://perldoc.perl.org/perlrun.html - by
giving -p and -i (untested) you can replace the contents of a file in-place.
untested?! Why don't you test it before recommending
At 15:38 -0800 06/02/2011, David Newman wrote:
Having the CSV output appear in the message body is a problem for the
nontechnical audience that will receive this message.
Why not just zip it? Archive::zip ?
JD
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional
At 13:00 -0500 04/02/2011, Uri Guttman wrote:
HP Yet they seem to be carefully avoided. That is what I nearly always
HP use. Is there some reason to avoid `//' as delimiters?
[ I really object to the backtick being used instead of an opening
quote mark. The only possiblt excuse for it
At 18:52 +0800 03/02/2011, Jeff Pang wrote:
2011/2/2 Shlomit Afgin shlomit.af...@weizmann.ac.il:
I tried to convert html special characters to their real character.
For example, converting #8221; to .
I had the string
$str = #8220; test #8221; ÈÒÈÂÔ†¢ª
The string
At 10:51 -0800 01/02/2011, loan tran wrote:
I'm having problem getting multiple values returned from a subroutine.
Thanks in advance for pointers.
If you want help with a problem you should present the problem as
simply as possible in a runnable form and not require your helpers to
wade
At 17:08 -0800 01/02/2011, Kenneth Wolcott wrote:
how do make certain that no input (keyboard + mouse paste) is outside
of 7-bit ASCII in a perl script?
The regular expression means that from the beginning to the end of
the (chomped) input is either nothing or a string containing only
At 22:17 -0800 30/01/2011, John W. Krahn wrote:
p...@mail.nsbeta.info wrote:
$ perl -MTime::Local -le 'print timelocal(0,0,0,1,1,1900)'
Cannot handle date (0, 0, 0, 1, 1, 1900) at -e line 1
why Time::Local can't handle the date of 1900?
Unix time starts at 1 Jan. 1970 so a time in 1900 is
On 15 January 2011 07:52, Emeka emekami...@gmail.com wrote:
# perl -le '$str = the cat sat on the mat;print substr( $str, 4, -4 )'
Can't find string terminator ' anywhere before EOF at -e line 1.
rmicro@RMICRO-PC C:\Program Files\xampp
#
It failed to work for me. Why?
Because you can't
At 02:34 -0500 13/01/2011, shawn wilson wrote:
I dig what you're saying about always using return. However I don't (have
never used / seen) a case where a sub returns last expression. An example
maybe?
#!/usr/local/bin/perl
use strict;
use feature qw(say);
say SUB();
sub SUB {
my $word =
At 12:52 +0200 12/01/2011, Shlomi Fish wrote:
http://search.cpan.org/~jfearn/HTML-
Tree-4.1/lib/HTML/Element.pm#$h-%3Etag%28%29_or_$h-%3Etag%28%27tagname%27%29
(sorry for the broken link).
Links won't break in proper mailers if you enclose them in
At 18:16 -0800 07/01/2011, S.F. wrote:
I have a data file with n columns and r row.
The first 3 columns and the first 5 rows are:
2 3 1
1 6 X
4 0 X
X 8 X
5 X 5
The X means missing.
How could I write a script to calculate the average by column and
replace X with the average?
There must be a
At 11:55 -0600 06/01/2011, David Waner wrote:
From: John Delacour [mailto:johndelac...@gmail.com]
#!/usr/bin/perl
use strict;
my $csv=temp.csv;
open CSV, $csv;
print CSV qq~1,2,3\n4\n5\n6,7,8~;
For something that should have been relatively easy, this has been a
real pain in getting
At 11:25 -0700 06/01/2011, Chris Stinemetz wrote:
I am having problems using hash function. I would like to only
extract 4 columns of data from a text file that is ; delimited.
Below is my code along with the errors I am receiving. Any help is
appreciated.
1. #!/usr/bin/perl
2.
At 17:56 -0600 04/01/2011, Wagner, David wrote:
I am generating an CSV and want a couple of fields to have soft
returns in them. I went into Excel and added a couple of soft
returns to a couple of different fields and then saved the modified
file back to a CSV.
If you run this script you
At 01:09 -0500 04/01/2011, George Worroll wrote:
On 1/4/11 12:33 AM, Sunita Rani Pradhan wrote:
Perl script works without the first line ( perl Interpreter
: #! /usr/bin/perl) . What is the real use of this line ? This line does
not through any error on Windows where , this path
On 24 December 2010 14:49, Jugurtha Hadjar jugurtha.had...@gmail.com wrote:
I rewrote your code and at the very beginning, just before any variable was
/used/ [i.e, just after use strict, I added
# Intialization begins
my $cell ='';
my $filename ='';
If you're going to an empty
56 matches
Mail list logo