At 10:42 PM -0230 4/8/12, Tiago Hori wrote:
Hi Guys,
I know there are modules for parsing tab delimited files, but I am
trying to develop a script as a learning exercise to learn the
better, so any help would be appreciated.
Let's say I have two columns and two rows:
Joe \t Doe
Jane \t Doe
On Sun, Apr 08, 2012 at 08:44:53PM -0700, Binish A.R wrote:
> replace @array = split (/\t/, $_); with
> @array = split;
I advise to not do that, because when you add more data - like
Joe Bob \t Briggs
@array will have three elements.
My output from your sample data and p
Tiago Hori wrote:
Hi Guys,
Hello,
I know there are modules for parsing tab delimited files, but I am
trying to develop a script as a learning exercise to learn the better,
so any help would be appreciated.
Let's say I have two columns and two rows:
Joe \t Doe
Jane \t Doe
So here is what I
replace @array = split (/\t/, $_); with
@array = split;
From: Tiago Hori
To: beginners@perl.org
Sent: Monday, April 9, 2012 6:42 AM
Subject: Help parsing tab delimited files
Hi Guys,
I know there are modules for parsing tab delimited fi
Hi Guys,
I know there are modules for parsing tab delimited files, but I am trying to
develop a script as a learning exercise to learn the better, so any help would
be appreciated.
Let's say I have two columns and two rows:
Joe \t Doe
Jane \t Doe
So here is what I got:
#!usr/bin/perl
use st
At 3:33 AM +0530 4/9/12, S Pratap Singh wrote:
Hi ,
I have few files which contains user name and data transfer rate in MBs and
this data is collected for year and for each month report is saved in 12
different files I have to merge all the files to prepare the final report
Files are as below
Somu wrote:
Hello everyone...
Hello,
Thanks for the previous replies. I'm really improving!
A new problem..
Check if the word begins with un or in and has exactly 5 letters.
$word =~ '^(un|in).{3}$'
You should use the matching operator on the right hand side of the
binding operator instea
Hi ,
I have few files which contains user name and data transfer rate in MBs and
this data is collected for year and for each month report is saved in 12
different files I have to merge all the files to prepare the final report
Files are as below
Filename1 : January
#User Name #Data
At 12:50 AM + 4/9/12, Vyacheslav wrote:
I enabled RaiserError, then script die.
...
my %attr = (
PrintError => 0,
RaiseError => 1
);
Use:
RaiseError => 0
instead so that your script will not raise an exception and die. Then
check $dbh->err.
--
To unsubscribe, e-mail: beginne
I enabled RaiserError, then script die.
...
my %attr = (
PrintError => 0,
RaiseError => 1
);
my $dbh = DBI->connect($dsn, $user, $pass, \%attr); # or die "Can't
connect to the DB: $DBI::errstr\n";
my $query = "SHOW DATABASES";
my $sth = $dbh->prepare($query) or die "Can't prepare SQL st
On 2012-04-08 17:10, Vyacheslav wrote:
using eval helped me.
You should not use exceptions for normal code flow.
Read the DBI docs (perldoc DBI).
If a failed connection must be an exception, set RaiseError to true.
But if it isn't an exception, leave it false, and test $dbh->err (or the
glob
On 08/04/2012 12:00, Somu wrote:
Hello everyone...
Thanks for the previous replies. I'm really improving!
A new problem..
Check if the word begins with un or in and has exactly 5 letters.
$word =~ '^(un|in).{3}$'
Check if the word begins with un or in or non and has more than 5 letters.
$word
Hi Vyacheslav,
On Sun, 08 Apr 2012 15:10:06 +
Vyacheslav wrote:
> Thanks all.
>
> using eval helped me.
>
The problem with eval in Perl 5 is that it catches any and all thrown exceptions
. I.e: by default, it doesn't do Object-Oriented exceptions like Java, Ruby,
Python and other language
yes... Maybe have to work with this only... Thanks
$word =~ /^((un|in).{3}|non.{2})$/
if you are looking for the regex only solution, then you may try this
$word =~ /^((un|in).{3}|non.{2})$/
From: Binish A.R
To: "som@gmail.com" ; "beginners@perl.org"
Sent: Sunday, April 8, 2012 6:19 PM
Subject: Re: regex
Why don't you check the leng
Why don't you check the length of the string as well .. ie
if (length($word) == 5 && $word =~ /^(un|in|non).+$/) {
## Do something
}
From: Somu
To: beginners@perl.org
Sent: Sunday, April 8, 2012 4:30 PM
Subject: regex
Hello everyone...
Thanks for the pre
Thanks all.
using eval helped me.
08.04.2012 09:43, Shlomi Fish пишет:
Hi Vyacheslav,
On Sun, 08 Apr 2012 06:12:53 +
Vyacheslav wrote:
Hello all.
My english bad and i have a problem.
I am connected to databases in a cycle foreach and the script die, if
one of database is not available.
Hello everyone...
Thanks for the previous replies. I'm really improving!
A new problem..
Check if the word begins with un or in and has exactly 5 letters.
$word =~ '^(un|in).{3}$'
Check if the word begins with un or in or non and has more than 5 letters.
$word =~ '^(un|in).{3}.+$'
What do i do
Hi Vyacheslav,
On Sun, 08 Apr 2012 06:12:53 +
Vyacheslav wrote:
> Hello all.
> My english bad and i have a problem.
>
> I am connected to databases in a cycle foreach and the script die, if
> one of database is not available.
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use DBI;
Enclose DBI operation inside eval
-
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use DBD::mysql;
foreach $db (&hostdb("$project")) {
eval {
my $server = "$db";
my $dbname = "information_schema";
my $port = "3306";
my
20 matches
Mail list logo