[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What config file for a .pm perl module ?



I demand that Eric Van Buggenhaut may or may not have written...

> On Thu, Dec 27, 2001 at 09:19:16AM -0600, Steve Langasek wrote:
[snip]
> #!/usr/bin/perl -w

> #open (IN,"/etc/dbix-password.conf");
> open (IN,"dbix-password.conf");

> while (<IN>) {
>         next if (/^#/ || /^$/);
>         @host = m/:?([^':]*)||:?'([^']*)'/g;
>         foreach (@host) {print "$_ "};
>         print "\n";
> }

> close IN;

This, instead of the @host assignment line, seems to work:

  @host = m/:?('[^']*'|[^':]*)/g;           # split, leaving 'quoted' as is
  foreach (@host) { $_ =~ s/^'(.*)'$/$1/; } # 'quoted' => quoted

I /think/ that what's happening is that all parenthesised expressions in the
regexp are being assigned to @host, whether defined (matched) or not.

-- 
| Darren Salt       | linux (or ds) at | nr. Ashington,
| Linux PC, Risc PC | youmustbejoking  | Northumberland
| No Wodniws here   | demon co uk      | Toon Army
|   <URL:http://www.youmustbejoking.demon.co.uk/progs.linux.html#debian>

It's all in the mind, you know.



Reply to: