Re: Help needed for perl rookie

From: GRLCOPM (grlcopm_at_pacbell.net)
Date: 12/27/04


Date: Mon, 27 Dec 2004 22:29:57 GMT


> From: ioneabu@yahoo.com
> Organization: http://groups.google.com
> Newsgroups: comp.lang.perl.misc
> Date: 27 Dec 2004 14:17:37 -0800
> Subject: Re: Help needed for perl rookie
>
>
> looks like you are replacing the spaces after the numbers with a '|'
> and removing the single quotes.
>
> s/(\d+)\s/$1|/g;
> s/'//g;
>

Yes, that is how I have changed the format of the data file. Replaced the
spaces with | and removed the single quotes from the last item on the line.

Can someone please explain what the the following line of code does and what
the replacement would be?

if (($acc,$day,$dayacc,$uri) = ($line =~ /^(\d+) (\d+) (\d+) '(\S+)'$/)) {

Thanks

Patrick



Relevant Pages

  • Re: sed and bash-script --- help in search and replace content of file.
    ... First, you put variables between single quotes when invoking sed, so the ... corrected the first problem the file data_file would still remain unchanged. ... now it is only replacing First Value... ... redirecting to output file. ...
    (comp.unix.shell)
  • Re: Handling apostrophes and other characters
    ... then you now have to find someway to escape real underscores. ... > the data you display, then what if the original input string looked like ... > So if you tried to replace the underscores with single quotes for display, ... Note that replacing a single ...
    (microsoft.public.inetserver.asp.general)
  • Re: What Did I Miss Here?
    ... If I don't use the replace function the sql statement ... >> text fields from a form to string fields in a table. ... >> some single quotes so in my update command I am replacing single quotes ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Handling apostrophes and other characters
    ... Why would you suggest replacing it with an underscore? ... then you now have to find someway to escape real underscores. ... the data you display, then what if the original input string looked like ... So if you tried to replace the underscores with single quotes for display, ...
    (microsoft.public.inetserver.asp.general)
  • Re: Fill out name fields if record exists
    ... From a thread on this forum I also tried replacing the single quotes ... delimiters; they're interchangable. ...
    (microsoft.public.access.forms)