parsing script help please

2012-05-31 Thread nathalie
Hi I have this format of file: (see attached example) 1 3206102-3207048 3411782-3411981 3660632-3661428 2 4481796-4482748 4483180-4483486 and I would like to change it to this 1 3206102-3207048 1 3411782-3411981 1 3660632-3661428 2 4481796-4482748 2

Re: parsing script help please

2012-05-31 Thread Rob Coops
On Thu, May 31, 2012 at 11:37 AM, nathalie n...@sanger.ac.uk wrote: Hi I have this format of file: (see attached example) 1 3206102-3207048 3411782-3411981 3660632-3661428 2 4481796-4482748 4483180-4483486 and I would like to change it to this 1 3206102-3207048 1

Re: parsing script help please

2012-05-31 Thread John W. Krahn
nathalie wrote: Hi Hello, I have this format of file: (see attached example) 1 3206102-3207048 3411782-3411981 3660632-3661428 2 4481796-4482748 4483180-4483486 and I would like to change it to this 1 3206102-3207048 1 3411782-3411981 1 3660632-3661428 2 4481796-4482748 2 4483180-4483486

Re: parsing script help please

2012-05-31 Thread nathalie
thanks a lot Rob I would like an output without the $VAR... so I did add this after the push function and it is perfect, thanks a lot again foreach my $number(@othernumbers){print $rownum,\t,$elet, \n;} #!/usr/local/bin/perl use strict; use warnings; my $fh; my %results; open ( $fh,

Re: parsing script help please

2012-05-31 Thread nathalie
You want something like this: #!/software/bin/perl use warnings; use strict; my $file = example.txt; open my $in, '', $file or die Cannot open '$file' because: $!; while ( $in ) { next if /^#/; chomp; my ( $key, @fields ) = split /\t/; print map $key\t$_\n, @fields; }

Regex behavior in command line

2012-05-31 Thread Jon Forsyth
Hello, I'm using the following line in Terminal, on OSX Lion, but I can't seem to match parentheses '()': perl -n -e 'print if(/\\(Submit\\)/)' visits/admin_add.ctp I tried with one backslash in front of each '(' ')' as well to no avail. If I remove the '\'s and '()' the match is printed like

Re: Regex behavior in command line

2012-05-31 Thread Shawn H Corey
On 12-05-31 01:23 PM, Jon Forsyth wrote: Hello, I'm using the following line in Terminal, on OSX Lion, but I can't seem to match parentheses '()': perl -n -e 'print if(/\\(Submit\\)/)' visits/admin_add.ctp I tried with one backslash in front of each '(' ')' as well to no avail. If I remove

Bareword and strict subs

2012-05-31 Thread Mark Haney
I'm getting this error in one of my packages (built by a previous coder): Bareword %s not allowed while strict subs in use In this case the %s is attrs. Here's the bit of code it's choking on: sub insert_shift { my $self = shift; my $attrs = @_; my $m =

Re: Bareword and strict subs

2012-05-31 Thread Shawn H Corey
On 12-05-31 06:28 PM, Mark Haney wrote: sub insert_shift { my $self = shift; my $attrs = @_; Should this be: my %attrs = @_; my $m = $self-schema-resultset('Shifts')-new(attrs); my $m = $self-schema-resultset('Shifts')-new(%attrs); $m-insert; } --

RE: Bareword and strict subs

2012-05-31 Thread Michael Brader
A bareword is an unquoted string appearing in Perl source. Depending on context it is treated as a sub call or a string (or a filehandle and a few other things I'd imagine). Barewords that are not sub calls are generally not permitted under use strict (specifically use strict 'subs'), with

suggestion for converting perl data to pdf

2012-05-31 Thread jbiskofski
This really has nothing to do with Perl, but since Perl is the language I use and I trust you are all bright, helpful and experiences I figured I would give it a shot. I work for a startup that builds an academic and administrative platform for private schools and universities in Mexico. Our code

Re: suggestion for converting perl data to pdf

2012-05-31 Thread Shawn H Corey
On 12-05-31 07:31 PM, jbiskofski wrote: I appreciate any input suggestions, thanks for reading. http://scribus.net/canvas/Scribus -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. _Perl links_

Re: Bareword and strict subs

2012-05-31 Thread Chris Nehren
On Thu, May 31, 2012 at 18:35:21 -0400 , Shawn H Corey wrote: On 12-05-31 06:28 PM, Mark Haney wrote: sub insert_shift { my $self = shift; my $attrs = @_; Should this be: my %attrs = @_; As Mark seems to be using DBIx::Class, and the new method on ::ResultSet classes is

Re: Bareword and strict subs

2012-05-31 Thread Shawn H Corey
On 12-05-31 08:26 PM, Chris Nehren wrote: On Thu, May 31, 2012 at 18:35:21 -0400 , Shawn H Corey wrote: On 12-05-31 06:28 PM, Mark Haney wrote: sub insert_shift { my $self = shift; my $attrs = @_; Should this be: my %attrs = @_; As Mark seems to be using DBIx::Class, and

Re: Bareword and strict subs

2012-05-31 Thread Chris Nehren
On Thu, May 31, 2012 at 20:36:50 -0400 , Shawn H Corey wrote: Should this be: my %attrs = @_; As Mark seems to be using DBIx::Class, and the new method on ::ResultSet classes is defined as taking \%attrs, probably not. my $attrs = @_; This will store the number of elements in

Re: Bareword and strict subs

2012-05-31 Thread Shawn H Corey
On 12-05-31 09:00 PM, Chris Nehren wrote: On Thu, May 31, 2012 at 20:36:50 -0400 , Shawn H Corey wrote: Should this be: my %attrs = @_; As Mark seems to be using DBIx::Class, and the new method on ::ResultSet classes is defined as taking \%attrs, probably not. my $attrs = @_; This