Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Finding unique vals from a inout file

by starbolin (Hermit)
on Jun 30, 2008 at 18:05 UTC ( #694794=note: print w/replies, xml ) Need Help??

in reply to Finding unique vals from a inout file

Your code slurps the whole file into the first element of @Deploy. Probably not what you wanted.

EDIT: As jethro= points out the original code works. So the following code is no more correct than the OP.

Here, this works:

Troll [113] as maint ~/ %cat foobar + [DING!] #!/usr/bin/perl @Deploy = split "\n",<DATA>; chomp(@Deploy); my @tmp = @Deploy; my %saw = (); foreach my $view_name (@Deploy) { print "view name is $view_name \n"; push (@Deploy1, $view_name) unless $saw{$view_name}++; } print join("\n",@Deploy1); __DATA__ t\test1\WEB\TEST/Admin*V:/test_viewINT/test_CVOB/test_src/Admin/AdminM +enu.asp" \\test\test1\WEB\TEST/Admin*V:/test_viewINT/test_CVOB/test_src/Admin/a +dminUser.asp" \\test\test1\WEB\TEST/Admin*V:/test_viewINT/test_CVOB/test_src/Admin/A +dminMenu.asp" \\test\test1\WEB\TEST/Admin*V:/test_viewINT/test_CVOB/test_src/Admin/a +dminUser.asp"
Outputs two elements as I think you wanted.

s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

Replies are listed 'Best First'.
Re^2: Finding unique vals from a inout file
by jethro (Monsignor) on Jun 30, 2008 at 18:45 UTC
    No, it doesn't:
    #!/usr/bin/perl -w @Deploy = <>; print scalar(@Deploy);

    > ./ < 4

      Sometimes, in spite of careful testing, one screws up. As I did. You are correct jethro.

      s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://694794]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2022-09-27 03:50 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (118 votes). Check out past polls.