Vijay wrote:
>
> Hi All,
>
> I'm running a Perl statement to fetch some data from a database.
>
> Lets assume that I want to pull out some data whose description starts
> with "ST:"
>
> I'm passing description as one of my parameter in my Perl code. I want
> to assign a value to the description such that It pulls out all the data
> starting with "ST:"
>
> I tried using the following:
>
> $description == 'ST:' but it was looking for the exact text.
>
> I tried using some wildcards but it did not support.
>
> can any one help me with a code to find out to pull all the rows whose
> description starts with ST:?
>
> Thanks for your help.
>
>
> - Vijay Swaminathan
>
Most of the databases indeed can use some form of "wildcards". For that you
should read the manual of the database.
If you want to do it in Perl, you should use regular expressions.
Assuming that you put the data from the database into the $description
variable (probably on a record by record basis in some form of loop)
$description =~ m/^ST:/
would match any data starting with "ST:"
Karl
aka CountZero at Perlmonks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This message and any attachments are confidential. If you have received
this message in error please delete it from your system. If you require any
assistance please notify the sender. Thank You.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs