[Chicago-talk] string operator question.
Richard Reina
richard at rushlogistics.com
Sat Sep 12 07:42:17 PDT 2009
I think I've got it now. I found this:
$mystring = "[2004/04/13] The date of this article.";
if($mystring =~ m/(\d+)/) {
print "The first number is $1.";
}
in a tutorial at http://www.somacon.com/p127.php
and hacked it up so that my number gets the value of
$number = $1
and it works.
However, I am confused by the representation of the scalar $1 I have never seen that before. Can someone explain $1. Or is it something that should not be explained but instead accepted at face value?
---- Chicago.pm chatter <chicago-talk at pm.org> wrote:
>
> Thank you very much Andy. Problem solved.
> ---- Chicago.pm chatter <chicago-talk at pm.org> wrote:
> >
> >
> > On Sep 12, 2009, at 8:52 AM, Richard Reina wrote:
> >
> > > require "/usr/src/laundpad/ORD_processor.pl";
> > > my $result = process($number);
> > >
> > >
> > > snip
> > >
> > > #!/usr/bin/perl -w
> > > # ORD_processor.pl
> > >
> > > sub process {
> > >
> > > print "I will attempt to process " . $number . "\n";
> > > chomp (my $XX = <STDIN>);
> > >
> > > }
> >
> > You're not taking number as the arg to process(). You need
> >
> > my $number = shift;
> >
> > xoxo,
> > Andy
> >
> > --
> > Andy Lester => andy at petdance.com => www.theworkinggeek.com => AIM:petdance
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > Chicago-talk mailing list
> > Chicago-talk at pm.org
> > http://mail.pm.org/mailman/listinfo/chicago-talk
> >
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
More information about the Chicago-talk
mailing list