rocketperl has asked for the wisdom of the Perl Monks concerning the following question:
Hi im trying to use regular expression to capture the digits on my data stored on a file that contains alphanumeric data and store the output to a different file. I am not getting any errors and the size of my output file has increased after execution but do not see any data.
my input data contains rows like this below#!/usr/bin/perl open (FILE, 'name.tsv'); open (OFILE, '>probe_dist.tsv'); while (<FILE>) { my $name = (FILE=~ m/:(\d+)/); print OFILE "$name\n"; } close (FILE); exit;
My idea is to print the first occurrence of all the continuous digits in my file. pls helpchr1:4775792-4775851 chr1:4775842-4775901 chr1:4775852-4775911 chr1:4775902-4775961 chr1:4775952-4776011 chr1:4776002-4776061 chr1:4776052-4776111 chr1:4776102-4776161 chr1:4776212-4776271 chr1:4776252-4776311 chr1:4776302-4776361 chr1:4776352-4776411 chr1:4776402-4776461 chr1:4776452-4776511 chr1:4776502-4776561 chr1:4777032-4777091 chr1:4777082-4777141
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: handling files using regular expression
by marto (Cardinal) on Jun 28, 2013 at 13:36 UTC | |
by rocketperl (Sexton) on Jun 28, 2013 at 13:42 UTC | |
by hdb (Monsignor) on Jun 28, 2013 at 13:54 UTC | |
by rocketperl (Sexton) on Jun 28, 2013 at 15:24 UTC | |
by marto (Cardinal) on Jun 28, 2013 at 13:57 UTC | |
by hippo (Bishop) on Jun 28, 2013 at 13:49 UTC | |
Re: handling files using regular expression
by ww (Archbishop) on Jun 28, 2013 at 13:58 UTC | |
Re: handling files using regular expression
by sundialsvc4 (Abbot) on Jun 28, 2013 at 15:37 UTC |
Back to
Seekers of Perl Wisdom