Why am I in this thread?
Please remove me from it
Sent from my iPhone
> On Nov 25, 2015, at 7:13 PM, Jin Xu wrote:
>
> Try to use below updated ones:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> while (my $line = <>) {
> while ($line =~
> s#\d+\s*[*+-/]\s*\d+(\s*[*+-/]\s*\d
Try to use below updated ones:
#!/usr/bin/perl
use strict;
use warnings;
while (my $line = <>) {
while ($line =~
s#\d+\s*[*+-/]\s*\d+(\s*[*+-/]\s*\d+)*##) {
my $result;
eval ("$result = $&;");
$line =~ s//$result/;
}
print ($line);
}
Regards,
Jin Xu
On Wed, 25 Nov 2015 17:22:04 +
Andrew Solomon wrote:
> The only problem I can see is that you want UPPERCASE-1234 and your
> regex has lowercase. Try
>
> (\A[A-Z]+) # match and capture leading alphabetics
Please put the anchor outside the capture. And you could use the POSIX
conventions:
The only problem I can see is that you want UPPERCASE-1234 and your regex
has lowercase. Try
(\A[A-Z]+) # match and capture leading alphabetics
Andrew
p.s Why not add "use strict; use warnings", "my $var;" and wear a seat belt
when you're driving?:)
On Wed, Nov 25, 2015 at 5:09 PM, Rick T
-- Forwarded message --
From: Raj Barath mailto:barat...@outlook.com>>
Date: Wed, Nov 25, 2015 at 1:16 PM
Subject: Re: regex problem?
To: Rick T mailto:p...@reason.net>>
Hi Rick,
You can use split.
For example:
my ( $stud_surname, $stud_number ) = split ( /-/, $student_id );
Yo
The following code apparently is not doing what I wanted. My intention was to
confirm that the general format of $student_id was this: several uppercase
letters followed by a hyphen followed by several digits. If not, it would
trigger the die. Unfortunately it seems to always trigger the die. F
Hi Gary,
I don't know what you are trying to do with that code... :( Still, it's
valid this way:
#!/usr/bin/perl
use strict;
use warnings;
print "Content-type: text/html\n\n"; #Only if you want this format
while (my $line = <>) {
while ($line =~ s#\d+\s*[*+-/]\s*\d+(\s*[*+-/]\s*\d+)*##) {
> gb@MINT ~/Perl5/perl programs $ cat prog164.pl
> #!/usr/bin/perl
> use strict;
> use warnings;
> while ($line = <>) {
> while ($line =~
> s#\d+\s*[*+-/]\s*\d+(\s*[*+-/]\s*\d+)*##) {
> eval ("\$result = $&;");
> $line =~ s//$result/;
>
> }
> print ($line);
> }
gb@MINT ~/Perl5/perl programs $ cat prog164.pl
#!/usr/bin/perl
use strict;
use warnings;
while ($line = <>) {
while ($line =~
s#\d+\s*[*+-/]\s*\d+(\s*[*+-/]\s*\d+)*##) {
eval ("\$result = $&;");
$line =~ s//$result/;
}
print ($line);
}
gb@MINT ~/Perl5/perl pr
Hi Sunita,
On Wed, 25 Nov 2015 13:23:24 +0530
Sunita Pradhan wrote:
> Hi
> I want to create a unique array .
You probably mean an "array with unique elements". To do so, you should use a
hash. See:
http://perl-begin.org/topics/hashes/
> I have the code below. It is creating a array which wi
10 matches
Mail list logo